Leak less memory

This commit is contained in:
Martijn Braam 2020-10-02 14:09:17 +02:00
parent 74ff1c5268
commit 123499092d
1 changed files with 8 additions and 3 deletions

11
main.c
View File

@ -260,8 +260,8 @@ static void
init_sensor(char *fn, int width, int height, int mbus, int rate) init_sensor(char *fn, int width, int height, int mbus, int rate)
{ {
int fd; int fd;
struct v4l2_subdev_frame_interval interval; struct v4l2_subdev_frame_interval interval = {};
struct v4l2_subdev_format fmt; struct v4l2_subdev_format fmt = {};
fd = open(fn, O_RDWR); fd = open(fn, O_RDWR);
g_printerr("Setting sensor rate to %d\n", rate); g_printerr("Setting sensor rate to %d\n", rate);
@ -484,6 +484,7 @@ process_image(const int *p, int size)
cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_NONE); cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_NONE);
cairo_paint(cr); cairo_paint(cr);
gtk_widget_queue_draw_area(preview, 0, 0, preview_width, preview_height); gtk_widget_queue_draw_area(preview, 0, 0, preview_width, preview_height);
cairo_destroy(cr);
} else { } else {
capture--; capture--;
time(&rawtime); time(&rawtime);
@ -613,13 +614,17 @@ process_image(const int *p, int size)
g_clear_error(&error); g_clear_error(&error);
} }
g_object_unref(pixbuf);
// Start post-processing the captured burst // Start post-processing the captured burst
g_printerr("Post process %s to %s.ext\n", burst_dir, fname_target); g_printerr("Post process %s to %s.ext\n", burst_dir, fname_target);
sprintf(command, "%s %s %s &", processing_script, burst_dir, fname_target); sprintf(command, "%s %s %s &", processing_script, burst_dir, fname_target);
system(command); system(command);
} }
} }
g_object_unref(pixbufrot);
g_object_unref(pixbuf);
} }
static gboolean static gboolean