Merge commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Dec 2013 19:31:29 +0000 (20:31 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Dec 2013 19:31:29 +0000 (20:31 +0100)
* commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c':
  avcodec: Use av_reallocp where suitable

Conflicts:
libavcodec/bitstream.c
libavcodec/eatgv.c
libavcodec/flashsv.c
libavcodec/libtheoraenc.c
libavcodec/libvpxenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/bitstream.c
libavcodec/eatgv.c
libavcodec/flashsv.c
libavcodec/g2meet.c
libavcodec/h264_mp4toannexb_bsf.c
libavcodec/libmp3lame.c
libavcodec/libschroedingerenc.c
libavcodec/libtheoraenc.c
libavcodec/libvpxenc.c
libavcodec/shorten.c

@@@ -108,12 -106,17 +108,16 @@@ static int alloc_table(VLC *vlc, int si
  
      vlc->table_size += size;
      if (vlc->table_size > vlc->table_allocated) {
+         int err;
          if (use_static)
 -            return AVERROR_BUG;
 +            abort(); // cannot do anything, init_vlc() is used with too little memory
          vlc->table_allocated += (1 << vlc->bits);
 -        if ((err = av_reallocp(&vlc->table,
 -                               sizeof(VLC_TYPE) * 2 *
 -                               vlc->table_allocated)) < 0) {
 +        vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
-         if (!vlc->table)
++        if (!vlc->table) {
+             vlc->table_allocated = 0;
+             vlc->table_size = 0;
 -            return err;
 +            return AVERROR(ENOMEM);
+         }
      }
      return index;
  }
Simple merge
@@@ -351,12 -338,14 +349,14 @@@ static int flashsv_decode_frame(AVCodec
      /* we care for keyframes only in Screen Video v2 */
      s->is_keyframe = (avpkt->flags & AV_PKT_FLAG_KEY) && (s->ver == 2);
      if (s->is_keyframe) {
-         s->keyframedata = av_realloc(s->keyframedata, avpkt->size);
+         int err;
+         if ((err = av_reallocp(&s->keyframedata, avpkt->size)) < 0)
+             return err;
          memcpy(s->keyframedata, avpkt->data, avpkt->size);
 -        if ((err = av_reallocp(&s->blocks, (v_blocks + !!v_part) *
 -                               (h_blocks + !!h_part) * sizeof(s->blocks[0]))) < 0)
 -            return err;
      }
 +    if(s->ver == 2 && !s->blocks)
 +        s->blocks = av_mallocz((v_blocks + !!v_part) * (h_blocks + !!h_part) *
 +                               sizeof(s->blocks[0]));
  
      av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
              s->image_width, s->image_height, s->block_width, s->block_height,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge