lavfi/avcodec: check avfilter_copy_frame_props() return code
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Nov 2012 19:54:25 +0000 (20:54 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Nov 2012 20:37:40 +0000 (21:37 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/avcodec.c

index 2a173b2..feaf641 100644 (file)
@@ -77,7 +77,10 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame
                                                   frame->format);
     if (!picref)
         return NULL;
-    avfilter_copy_frame_props(picref, frame);
+    if (avfilter_copy_frame_props(picref, frame) < 0) {
+        picref->buf->data[0] = NULL;
+        avfilter_unref_bufferp(&picref);
+    }
     return picref;
 }
 
@@ -90,7 +93,10 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
                                                   av_frame_get_channel_layout(frame));
     if (!samplesref)
         return NULL;
-    avfilter_copy_frame_props(samplesref, frame);
+    if (avfilter_copy_frame_props(samplesref, frame) < 0) {
+        samplesref->buf->data[0] = NULL;
+        avfilter_unref_bufferp(&samplesref);
+    }
     return samplesref;
 }