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
2 changed files with 2 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ Rear: {
{Type: "Link", From: "ov5640", FromPad: 0, To: "sun6i-csi", ToPad: 0}, {Type: "Link", From: "ov5640", FromPad: 0, To: "sun6i-csi", ToPad: 0},
{Type: "Mode", Entity: "ov5640"} {Type: "Mode", Entity: "ov5640"}
); );
} },
{ {
Width: 1280; Width: 1280;
Height: 720; Height: 720;

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) {