Andreas Rheinhardt (12020-01-04):
> Shouldn't you check for (ret < 0) instead of (!new)? I am unsure
> whether Coverity will really count this as a fix.

I hesitated and went for the minimalist patch. New version.

Regards,

-- 
  Nicolas George
From 8ef49a7c86e108ed9e6981d482ae892e6f62c0f5 Mon Sep 17 00:00:00 2001
From: Nicolas George <geo...@nsup.org>
Date: Sat, 4 Jan 2020 19:52:08 +0100
Subject: [PATCH 1/2] lavu/buffer: forward av_buffer_realloc() error code.

Fix CID 1457235.

Signed-off-by: Nicolas George <geo...@nsup.org>
---
 libavutil/buffer.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavutil/buffer.c b/libavutil/buffer.c
index 6d9cb7428e..d9552e3b24 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);
-        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));
 
-- 
2.24.1

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to