diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 23:31:29 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-12-09 23:31:29 +0400 |
commit | 8c677a9f06c5d145da0301cdc3c6bff9ebacb5d7 (patch) | |
tree | 9c756ade47cc06771cb120f53b5f9c22724717f6 /libavcodec/libmp3lame.c | |
parent | 94a849b8b6c3e4a90361485b2e12a9a5c35833a3 (diff) | |
parent | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (diff) |
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/libmp3lame.c')
-rw-r--r-- | libavcodec/libmp3lame.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 14fbb9ec56..e6cb64b876 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -59,18 +59,14 @@ typedef struct LAMEContext { static int realloc_buffer(LAMEContext *s) { if (!s->buffer || s->buffer_size - s->buffer_index < BUFFER_SIZE) { - uint8_t *tmp; - int new_size = s->buffer_index + 2 * BUFFER_SIZE; + int new_size = s->buffer_index + 2 * BUFFER_SIZE, err; av_dlog(s->avctx, "resizing output buffer: %d -> %d\n", s->buffer_size, new_size); - tmp = av_realloc(s->buffer, new_size); - if (!tmp) { - av_freep(&s->buffer); + if ((err = av_reallocp(&s->buffer, new_size)) < 0) { s->buffer_size = s->buffer_index = 0; - return AVERROR(ENOMEM); + return err; } - s->buffer = tmp; s->buffer_size = new_size; } return 0; |