aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/bitstream.c
diff options
context:
space:
mode:
authorAlexandra Khirnova <alexandra.khirnova@gmail.com>2013-12-06 13:44:17 +0100
committerMartin Storsjö <martin@martin.st>2013-12-09 12:27:51 +0200
commit9b8d11a76ae7bca8bbb58abb822138f8b42c776c (patch)
tree702aed7eb0e0684c7a91fdac06a9981fb4333c49 /libavcodec/bitstream.c
parentd4f1188d1a662fed5347e70016da49e01563e8a8 (diff)
downloadffmpeg-9b8d11a76ae7bca8bbb58abb822138f8b42c776c.tar.gz
avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavcodec/bitstream.c')
-rw-r--r--libavcodec/bitstream.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index e7c476ba4b..8e9f657b7f 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -106,12 +106,17 @@ static int alloc_table(VLC *vlc, int size, int use_static)
vlc->table_size += size;
if (vlc->table_size > vlc->table_allocated) {
+ int err;
if (use_static)
return AVERROR_BUG;
vlc->table_allocated += (1 << vlc->bits);
- vlc->table = av_realloc(vlc->table, sizeof(VLC_TYPE) * 2 * vlc->table_allocated);
- if (!vlc->table)
- return AVERROR(ENOMEM);
+ if ((err = av_reallocp(&vlc->table,
+ sizeof(VLC_TYPE) * 2 *
+ vlc->table_allocated)) < 0) {
+ vlc->table_allocated = 0;
+ vlc->table_size = 0;
+ return err;
+ }
}
return index;
}