Merge commit '7fccc96dc3c0bb2fa2079cbf4e4cf1aff2db46c8'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 31 May 2015 23:44:44 +0000 (01:44 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 31 May 2015 23:45:39 +0000 (01:45 +0200)
* commit '7fccc96dc3c0bb2fa2079cbf4e4cf1aff2db46c8':
  eatgv: Check memory allocation

Conflicts:
libavcodec/eatgv.c

See: a5615b82eb116e9fd0f71f2b03c333cc31ab706a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/eatgv.c

@@@ -173,10 -173,9 +173,11 @@@ static int tgv_decode_inter(TgvContext 
  
      /* allocate codebook buffers as necessary */
      if (num_mvs > s->num_mvs) {
-         if (av_reallocp_array(&s->mv_codebook, num_mvs, sizeof(*s->mv_codebook))) {
 -        int err = av_reallocp(&s->mv_codebook, num_mvs * 2 * sizeof(int));
 -        if (err < 0)
++        int err = av_reallocp_array(&s->mv_codebook, num_mvs, sizeof(*s->mv_codebook));
++        if (err < 0) {
 +            s->num_mvs = 0;
-             return AVERROR(ENOMEM);
+             return err;
 +        }
          s->num_mvs = num_mvs;
      }