From 9b8d11a76ae7bca8bbb58abb822138f8b42c776c Mon Sep 17 00:00:00 2001 From: Alexandra Khirnova Date: Fri, 6 Dec 2013 13:44:17 +0100 Subject: avcodec: Use av_reallocp where suitable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavcodec/bitstream.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'libavcodec/bitstream.c') 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; } -- cgit v1.2.3