diff options
author | Alexandra Khirnova <alexandra.khirnova@gmail.com> | 2013-12-06 13:44:17 +0100 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-12-09 12:27:51 +0200 |
commit | 9b8d11a76ae7bca8bbb58abb822138f8b42c776c (patch) | |
tree | 702aed7eb0e0684c7a91fdac06a9981fb4333c49 /libavcodec/libmp3lame.c | |
parent | d4f1188d1a662fed5347e70016da49e01563e8a8 (diff) | |
download | ffmpeg-9b8d11a76ae7bca8bbb58abb822138f8b42c776c.tar.gz |
avcodec: Use av_reallocp where suitable
Signed-off-by: Martin Storsjö <martin@martin.st>
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 ce0e9c8534..ee76ff8812 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -57,18 +57,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; |