Re: [libdc] bayer.c does not set out->allocated_image_bytes
Capture and control API for IIDC compliant cameras
Brought to you by:
ddouxchamps,
gordp
From: Damien D. <dd...@do...> - 2009-01-13 13:27:02
|
Hello Damien, On Tue, 2009-01-13 at 16:36 +1000, Damien Dusha wrote: > Dear libdc1394, > > There appears to be a bug in bayer.c, function > > Adapt_buffer_bayer(dc1394video_frame_t *in, dc1394video_frame_t *out, > dc1394bayer_method_t method) > > Specifically, after freeing and reallocating the buffer, the > allocated_image_bytes field is not set. In a program I am writing, I > look at this field before freeing a dc1394video_frame_t in order to > ensure that no data is allocated to the image buffer. Hence, if data > has indeed been allocated, but does not say so, I have a memory leak. > > Here is a simple patch that should fix it (and makes it consistent with > a similar function in conversions.h) Thanks, it's another bug indeed. This may be why I sometimes had crashes in coriander when using Bayer. Nice catch! I've applied your patch and added your memory allocation check "if(out->image)" to the other Adapt* functions in conversions.c. You can check revision 583 of the SVN to check your fixes. Cheers, -- Damien 高原 Douxchamps http://damien.douxchamps.net/ |