Add missing NULL checks in avfilter_ref_buffer().
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 17 Aug 2010 15:12:22 +0000 (15:12 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 17 Aug 2010 15:12:22 +0000 (15:12 +0000)
Originally committed as revision 24808 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavfilter/avfilter.c

index a0643c9..0d05c26 100644 (file)
@@ -48,9 +48,15 @@ const char *avfilter_license(void)
 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
 {
     AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
+    if (!ret)
+        return NULL;
     *ret = *ref;
     if (ref->type == AVMEDIA_TYPE_VIDEO) {
         ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps));
+        if (!ret->video) {
+            av_free(ret);
+            return NULL;
+        }
         *ret->video = *ref->video;
     }
     ret->perms &= pmask;