[FFmpeg-cvslog] lavfi: avfilter_merge_formats: handle case where inputs are same

Mina Nagy Zaki git at videolan.org
Fri Jun 10 13:10:39 CEST 2011


ffmpeg | branch: master | Mina Nagy Zaki <mnzaki at gmail.com> | Wed Jun  8 19:24:25 2011 +0300| [79a0ec1af4817bb7b989803b9f460d1e4acaf7b7] | committer: Stefano Sabatini

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.

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

 libavfilter/formats.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index ec7fca3..58593fc 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -44,6 +44,8 @@ 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 */



More information about the ffmpeg-cvslog mailing list