diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 20:31:29 +0100 |
commit | 8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7 (patch) | |
tree | 9c756ade47cc06771cb120f53b5f9c22724717f6 /libavcodec/g2meet.c | |
parent | 94a849b8b6c3e4a90361485b2e12a9a5c35833a3 (diff) | |
parent | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (diff) | |
download | ffmpeg-8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7.tar.gz |
Merge commit '9b8d11a76ae7bca8bbb58abb822138f8b42c776c'
* 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>
Diffstat (limited to 'libavcodec/g2meet.c')
-rw-r--r-- | libavcodec/g2meet.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c index c585d0de9b..8f8e88047a 100644 --- a/libavcodec/g2meet.c +++ b/libavcodec/g2meet.c @@ -236,16 +236,14 @@ static int jpg_decode_data(JPGContext *c, int width, int height, int swapuv) { GetBitContext gb; - uint8_t *tmp; int mb_w, mb_h, mb_x, mb_y, i, j; int bx, by; int unesc_size; int ret; - tmp = av_realloc(c->buf, src_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!tmp) - return AVERROR(ENOMEM); - c->buf = tmp; + if ((ret = av_reallocp(&c->buf, + src_size + FF_INPUT_BUFFER_PADDING_SIZE)) < 0) + return ret; jpg_unescape(src, src_size, c->buf, &unesc_size); memset(c->buf + unesc_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); init_get_bits(&gb, c->buf, unesc_size * 8); @@ -482,8 +480,7 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c, uint32_t bits; uint32_t cur_size, cursor_w, cursor_h, cursor_stride; uint32_t cursor_hot_x, cursor_hot_y; - int cursor_fmt; - uint8_t *tmp; + int cursor_fmt, err; cur_size = bytestream2_get_be32(gb); cursor_w = bytestream2_get_byte(gb); @@ -518,13 +515,11 @@ static int g2m_load_cursor(AVCodecContext *avctx, G2MContext *c, return AVERROR_PATCHWELCOME; } - tmp = av_realloc(c->cursor, cursor_stride * cursor_h); - if (!tmp) { + if ((err = av_reallocp(&c->cursor, cursor_stride * cursor_h)) < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate cursor buffer\n"); - return AVERROR(ENOMEM); + return err; } - c->cursor = tmp; c->cursor_w = cursor_w; c->cursor_h = cursor_h; c->cursor_hot_x = cursor_hot_x; |