Improve recycling

This commit is contained in:
Kamil Trzcinski
2022-04-06 08:44:15 +02:00
parent 25af6875f4
commit 4d999d9426
3 changed files with 17 additions and 3 deletions

View File

@ -23,6 +23,12 @@ void camera_close(camera_t *camera)
}
}
for (int i = MAX_DEVICES; i-- > 0; ) {
if (camera->links[i].callbacks.on_buffer) {
camera->links[i].callbacks.on_buffer = NULL;
}
}
memset(camera->links, 0, sizeof(camera->links));
free(camera);
}