summaryrefslogtreecommitdiff
path: root/libavutil/buffer.c
diff options
context:
space:
mode:
authorNicolas George <george@nsup.org>2020-01-04 19:52:08 +0100
committerNicolas George <george@nsup.org>2020-08-21 11:44:30 +0200
commit2b71cd3e0b1a545df670f0d057655e0b59b98f5f (patch)
tree8f978082c4e1b0fbaa722036efa45e13b9b371ed /libavutil/buffer.c
parent06f26512046de1a84e045d219e7fa211c37ad0e4 (diff)
downloadffmpeg-2b71cd3e0b1a545df670f0d057655e0b59b98f5f.tar.gz
lavu/buffer: forward av_buffer_realloc() error code.
Fix CID 1457235.
Diffstat (limited to 'libavutil/buffer.c')
-rw-r--r--libavutil/buffer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 38a554208a..08e6079139 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -170,6 +170,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
{
AVBufferRef *buf = *pbuf;
uint8_t *tmp;
+ int ret;
if (!buf) {
/* allocate a new buffer with av_realloc(), so it will be reallocatable
@@ -196,9 +197,9 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
/* cannot realloc, allocate a new reallocable buffer and copy data */
AVBufferRef *new = NULL;
- av_buffer_realloc(&new, size);
- if (!new)
- return AVERROR(ENOMEM);
+ ret = av_buffer_realloc(&new, size);
+ if (ret < 0)
+ return ret;
memcpy(new->data, buf->data, FFMIN(size, buf->size));