On Thu, Apr 23, 2015 at 3:20 PM, Vittorio Giovara
<[email protected]> wrote:
>>> --- a/libavcodec/eatgv.c
>>> +++ b/libavcodec/eatgv.c
>>> @@ -174,12 +174,15 @@ static int tgv_decode_inter(TgvContext *s, AVFrame 
>>> *frame,
>>>      /* allocate codebook buffers as necessary */
>>>      if (num_mvs > s->num_mvs) {
>>>          s->mv_codebook = av_realloc(s->mv_codebook, num_mvs*2*sizeof(int));
>>> +        if (!s->mv_codebook)
>>> +            return AVERROR(ENOMEM);
>>>          s->num_mvs = num_mvs;
>>>      }
>>>
>>>      if (num_blocks_packed > s->num_blocks_packed) {
>>>          int err;
>>>          if ((err = av_reallocp(&s->block_codebook, num_blocks_packed * 
>>> 16)) < 0) {
>>> +            av_freep(&s->mv_codebook);
>>>              s->num_blocks_packed = 0;
>>>              return err;
>>>          }
>>
>> This function has many more error returns, you leak memory in all those 
>> cases.
>
> ok i'll send a separate patch

Actually av_freep(&s->mv_codebook); is in the .close function, so the
extra addition is not necessary, I'll drop it entirely.

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

Reply via email to