[FFmpeg-cvslog] avfiltergraph: Properly handle memory allocation failure

Derek Buitenhuis git at videolan.org
Sun Oct 27 20:15:48 CET 2013


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Tue Oct 22 19:40:05 2013 +0100| [52aed19307ee0768b03a620005c4b2b5fda621c6] | committer: Derek Buitenhuis

avfiltergraph: Properly handle memory allocation failure

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=52aed19307ee0768b03a620005c4b2b5fda621c6
---

 libavfilter/avfiltergraph.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 2db2900..506d79e 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -392,6 +392,19 @@ static int can_merge_formats(AVFilterFormats *a_arg,
         return 1;
     a = clone_filter_formats(a_arg);
     b = clone_filter_formats(b_arg);
+
+    if (!a || !b) {
+        if (a)
+            av_freep(&a->formats);
+        if (b)
+            av_freep(&b->formats);
+
+        av_freep(&a);
+        av_freep(&b);
+
+        return 0;
+    }
+
     if (is_sample_rate) {
         ret = ff_merge_samplerates(a, b);
     } else {



More information about the ffmpeg-cvslog mailing list