avfilter/formats: Alloc NULL fmts in SET_COMMON_FORMATS()
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 21 Nov 2014 21:15:32 +0000 (22:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 21 Nov 2014 21:15:32 +0000 (22:15 +0100)
This avoids null pointer dereferences in case memory allocation has failed

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavfilter/formats.c

index 42afcf4..eb3b87a 100644 (file)
@@ -494,7 +494,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
 }
 
 #define SET_COMMON_FORMATS(ctx, fmts, in_fmts, out_fmts, ref, list) \
-{                                                                   \
+if (fmts) {                                                         \
     int count = 0, i;                                               \
                                                                     \
     for (i = 0; i < ctx->nb_inputs; i++) {                          \