aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-02-02 20:53:51 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-02-17 12:16:43 -0500
commitfe0f4e56577a2dbd373bb50b0ae2d49e69d822fc (patch)
treef642c2df6e7dd71ea4aa0c53cc4e4329fb46ed9a
parent31dc73e92a96f08d07650c0e7d31c0b9a1465d46 (diff)
downloadffmpeg-fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc.tar.gz
avpacket: Check buffer reference
CC: libav-stable@libav.org Bug-Id: CID 1267889
-rw-r--r--libavcodec/avpacket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 25eabdb215..557258d839 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;