[FFmpeg-devel] [PATCH] lavu/buffer: forward av_buffer_realloc() error code.

Nicolas George george at nsup.org
Sat Jan 4 20:52:48 EET 2020


Fix CID 1457235.

Signed-off-by: Nicolas George <george at nsup.org>
---
 libavutil/buffer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 6d9cb7428e..2f33e5ebb6 100644
--- a/libavutil/buffer.c
+++ b/libavutil/buffer.c
@@ -171,6 +171,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
@@ -197,9 +198,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);
+        ret = av_buffer_realloc(&new, size);
         if (!new)
-            return AVERROR(ENOMEM);
+            return ret;
 
         memcpy(new->data, buf->data, FFMIN(size, buf->size));
 
-- 
2.24.1



More information about the ffmpeg-devel mailing list