[FFmpeg-devel] [PATCH v3] lavf/h264: add support for h264 video from Arecont camera, fixes ticket #5154

Shivam Goyal shivgo at iitk.ac.in
Thu May 9 12:36:05 EEST 2019


On 09-05-2019 15:00, Moritz Barsnick wrote:

> On Thu, May 09, 2019 at 07:28:20 +0530, Shivam Goyal wrote: +    //Extra to find the http header
> +    size = 2 * ARECONT_H264_MIME_SIZE + RAW_PACKET_SIZE;
> +    data = av_malloc(size);
> +
> +    if (av_new_packet(pkt, size) < 0)
> +        return AVERROR(ENOMEM); 
> memleak on error

I have tested this on the file attached to the ticket, the error didn't
came. Please, could you tell me how to solve this error and why it came.

It's a hypothetical case. You can see the memleak by code review,
without the need for actually reproducing it with a real world test.

You need to clean up your allocated memory in error paths as well.
Please see many other places in the ffmpeg code.

Oh, i missed it, i forgot to clean the allocated pkt here, 
would do in the next version of patch. 

Thanks for the review 
Shivam Goyal


More information about the ffmpeg-devel mailing list