[FFmpeg-cvslog] avpacket: Check buffer reference

Vittorio Giovara git at videolan.org
Tue Feb 17 22:55:06 CET 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Feb  2 20:53:51 2015 +0100| [fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc] | committer: Vittorio Giovara

avpacket: Check buffer reference

CC: libav-stable at libav.org
Bug-Id: CID 1267889

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc
---

 libavcodec/avpacket.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 25eabdb..557258d 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -365,8 +365,13 @@ int av_packet_ref(AVPacket *dst, AVPacket *src)
         if (ret < 0)
             goto fail;
         memcpy(dst->buf->data, src->data, src->size);
-    } else
+    } else {
         dst->buf = av_buffer_ref(src->buf);
+        if (!dst->buf) {
+            ret = AVERROR(ENOMEM);
+            goto fail;
+        }
+    }
 
     dst->size = src->size;
     dst->data = dst->buf->data;



More information about the ffmpeg-cvslog mailing list