Compare commits

2 Commits

Author SHA1 Message Date
dec641dc51 load_camera: initialize with calloc to avoid uninitialized reads
in particular: if a sensor can't be found, then camera->sensor_path is
unassigned. this would cause a segfault later, in libmegapixels_open.
2024-05-19 02:43:59 +00:00
db064d4eee config: fix syntax error in pinepone.conf 2024-05-18 23:54:44 +00:00

View File

@@ -191,10 +191,7 @@ load_camera(libmegapixels_devconfig *config, config_t *cfg, const char *name)
return -1; return -1;
} }
libmegapixels_camera *camera; libmegapixels_camera *camera;
camera = malloc(sizeof(libmegapixels_camera)); camera = calloc(1, sizeof(libmegapixels_camera));
camera->sensor_fd = 0;
camera->media_fd = 0;
camera->video_fd = 0;
int res = find_media_node(camera, bridge_driver, sensor_driver); int res = find_media_node(camera, bridge_driver, sensor_driver);
if (res < 0) { if (res < 0) {