From fe0f4e56577a2dbd373bb50b0ae2d49e69d822fc Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Mon, 2 Feb 2015 20:53:51 +0100 Subject: [PATCH] avpacket: Check buffer reference CC: libav-stable@libav.org Bug-Id: CID 1267889 --- libavcodec/avpacket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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;