lavc/avpacket: check for malloc failure
authorwm4 <nfxjfg@googlemail.com>
Fri, 12 Dec 2014 17:15:42 +0000 (18:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Dec 2014 18:31:29 +0000 (19:31 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/avpacket.c

index 3c26046..1867476 100644 (file)
@@ -546,8 +546,11 @@ int av_packet_ref(AVPacket *dst, const 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)
+            goto fail;
+    }
 
     dst->size = src->size;
     dst->data = dst->buf->data;