Merge commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Jun 2013 21:29:37 +0000 (23:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 16 Jun 2013 21:29:37 +0000 (23:29 +0200)
* commit 'f80b60ad59945dae32bb26a4e239ed94b0e92fa3':
  bitstream: forward error values and drop few abort()

Conflicts:
libavcodec/bitstream.c

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

@@@ -108,11 -107,11 +108,11 @@@ static int alloc_table(VLC *vlc, int si
      vlc->table_size += size;
      if (vlc->table_size > vlc->table_allocated) {
          if (use_static)
 -            return AVERROR_BUG;
 +            abort(); // cannot do anything, init_vlc() is used with too little memory
          vlc->table_allocated += (1 << vlc->bits);
 -        vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
 +        vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2);
          if (!vlc->table)
-             return -1;
+             return AVERROR(ENOMEM);
      }
      return index;
  }
@@@ -339,8 -313,12 +339,8 @@@ int ff_init_vlc_sparse(VLC *vlc, int nb
      av_free(buf);
      if (ret < 0) {
          av_freep(&vlc->table);
-         return -1;
+         return ret;
      }
 -    if ((flags & INIT_VLC_USE_NEW_STATIC) &&
 -        vlc->table_size != vlc->table_allocated)
 -        av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n",
 -               vlc->table_size, vlc->table_allocated);
      return 0;
  }