On Tue, Apr 01, 2014 at 10:42:57AM +0530, Nidhi Makhijani wrote:
> --- a/libavformat/nutdec.c
> +++ b/libavformat/nutdec.c
> @@ -586,6 +591,8 @@ static int find_and_decode_index(NUTContext *nut)
>      GET_V(syncpoint_count, tmp < INT_MAX / 8 && tmp > 0);
>      syncpoints   = av_malloc(sizeof(int64_t) *  syncpoint_count);
>      has_keyframe = av_malloc(sizeof(int8_t)  * (syncpoint_count + 1));
> +    if (!syncpoints || !has_keyframe)
> +        return AVERROR(ENOMEM);

This is not so easy.  If the first allocation succeeded but the second
failed and you just return, you leak the memory from the first allocation.
In that case you need to av_free() the first allocation to avoid a
memory leak.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to