summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMina Nagy Zaki <mnzaki@gmail.com>2011-06-08 19:24:25 +0300
committerAnton Khirnov <anton@khirnov.net>2012-10-06 09:47:21 +0200
commita4e277312cacfb78ef7583ed0b4fe4ccf5a0bcb1 (patch)
treeb2a49f7a1f0b231909db6abe856eb18df9deb5ae
parentc82ae85a8a78a98f7c7fea68d24a4ac0ca74d01f (diff)
downloadffmpeg-a4e277312cacfb78ef7583ed0b4fe4ccf5a0bcb1.tar.gz
lavfi: avfilter_merge_formats: handle case where inputs are same
This fixes a double-free crash if lists are the same due to the two merge_ref() calls at the end of the (useless) merging that happens. Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit 11b6a82412bcd372adf694a26d83b07d337e1325) Conflicts: libavfilter/formats.c Signed-off-by: Reinhard Tartler <siretart@tauware.de> (cherry picked from commit e5f4e249422834f727bcd432b73af971277f1371) Signed-off-by: Anton Khirnov <anton@khirnov.net> (cherry picked from commit b6c5848a1f8fc2755ea70d325acaddae9fac45ab) Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavfilter/formats.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 2a9bdb0bd0..8b8bf75962 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -44,6 +44,9 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
AVFilterFormats *ret;
unsigned i, j, k = 0;
+ if (a == b)
+ return a;
+
ret = av_mallocz(sizeof(AVFilterFormats));
/* merge list of formats */