From 750080d576dadb9c29ac5f565b8e16c8b9aa4a7d Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Fri, 18 Mar 2011 11:00:33 +0100 Subject: Fix potential leak --- src/cameras/dummy.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/cameras/dummy.c') 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; } -- cgit v1.2.3