summaryrefslogtreecommitdiffstats
path: root/src/cameras/dummy.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-18 11:00:33 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-18 11:00:33 +0100
commit750080d576dadb9c29ac5f565b8e16c8b9aa4a7d (patch)
tree821a7b9a322ac426c8bac4ea7304381f2cc6d1c6 /src/cameras/dummy.c
parent431ab712487156522dc5e3981cde3e400faf28b1 (diff)
downloaduca-750080d576dadb9c29ac5f565b8e16c8b9aa4a7d.tar.gz
uca-750080d576dadb9c29ac5f565b8e16c8b9aa4a7d.tar.bz2
uca-750080d576dadb9c29ac5f565b8e16c8b9aa4a7d.tar.xz
uca-750080d576dadb9c29ac5f565b8e16c8b9aa4a7d.zip
Fix potential leak
Diffstat (limited to 'src/cameras/dummy.c')
-rw-r--r--src/cameras/dummy.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cameras/dummy.c b/src/cameras/dummy.c
index 5361301..2ad2ec9 100644
--- a/src/cameras/dummy.c
+++ b/src/cameras/dummy.c
@@ -241,9 +241,11 @@ uint32_t uca_dummy_start_recording(struct uca_camera *cam)
uint32_t uca_dummy_stop_recording(struct uca_camera *cam)
{
+ struct dummy_cam *dc = GET_DUMMY(cam);
if (cam->callback != NULL) {
- GET_DUMMY(cam)->thread_running = false;
- free(GET_DUMMY(cam)->buffer);
+ dc->thread_running = false;
+ free(dc->buffer);
+ dc->buffer = NULL;
}
cam->state = UCA_CAM_ARMED;
return UCA_NO_ERROR;
@@ -273,7 +275,9 @@ uint32_t uca_dummy_grab(struct uca_camera *cam, char *buffer, void *meta_data)
static uint32_t uca_dummy_destroy(struct uca_camera *cam)
{
- free(GET_DUMMY(cam));
+ struct dummy_cam *dc = GET_DUMMY(cam);
+ free(dc->buffer);
+ free(dc);
return UCA_NO_ERROR;
}