Closed Steve132 closed 2 years ago
This was my bad, I misunderstood what was happening here, exactly. This isn't trying to allocate a dynamic array it's trying to allocate exactly one struct buffer for each buffer, in this case one. So sizeof(struct buffer) is actually correct here.
Describe the bug
https://github.com/econsystems/opencv_v4l2/blob/979264c3e1cdab1480975fd62e2050db0c85ba23/lib/src/v4l2_helper.c#L210
sizeof(*buffers) is NOT the number of buffers in C.
it's a compile time constant that's always sizeof(struct buffer); https://godbolt.org/z/1oGzKdWEa
Therefore this code is bugged. It only happens to work because sizeof(struct buffer) > NUM_BUFFS on most platforms. But it is incorrect.