initialize struct v4l2_plane in mp_camera_*_buffer functions

without it ioctl parameter points to uninitialized value
This commit is contained in:
Egor Shestakov
2025-02-11 21:06:57 +07:00
parent ae1faec57d
commit 2f2929800b

View File

@@ -365,9 +365,9 @@ mp_camera_capture_buffer(MPCamera *camera, MPBuffer *buffer)
buf.type = buftype; buf.type = buftype;
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
struct v4l2_plane planes[1]; struct v4l2_plane planes = {};
if (camera->use_mplane) { if (camera->use_mplane) {
buf.m.planes = planes; buf.m.planes = &planes;
buf.length = 1; buf.length = 1;
} }
@@ -392,7 +392,7 @@ mp_camera_capture_buffer(MPCamera *camera, MPBuffer *buffer)
uint32_t bytesused; uint32_t bytesused;
if (camera->use_mplane) { if (camera->use_mplane) {
bytesused = planes[0].bytesused; bytesused = planes.bytesused;
} else { } else {
bytesused = buf.bytesused; bytesused = buf.bytesused;
} }
@@ -419,9 +419,9 @@ mp_camera_release_buffer(MPCamera *camera, uint32_t buffer_index)
buf.memory = V4L2_MEMORY_MMAP; buf.memory = V4L2_MEMORY_MMAP;
buf.index = buffer_index; buf.index = buffer_index;
struct v4l2_plane planes[1]; struct v4l2_plane planes = {};
if (camera->use_mplane) { if (camera->use_mplane) {
buf.m.planes = planes; buf.m.planes = &planes;
buf.length = 1; buf.length = 1;
} }