avfilter/formats: fix leak of formats on error
authorPaul B Mahol <onemda@gmail.com>
Sat, 2 Jan 2016 20:05:40 +0000 (21:05 +0100)
committerPaul B Mahol <onemda@gmail.com>
Thu, 7 Jan 2016 08:58:55 +0000 (09:58 +0100)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavfilter/formats.c

index a2b19e7..f12dcf4 100644 (file)
@@ -518,6 +518,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
             int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts);      \
             if (ret < 0) {                                          \
                 unref_fn(&fmts);                                    \
+                av_freep(&fmts->list);                              \
+                av_freep(&fmts);                                    \
                 return ret;                                         \
             }                                                       \
             count++;                                                \
@@ -528,6 +530,8 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
             int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts);      \
             if (ret < 0) {                                          \
                 unref_fn(&fmts);                                    \
+                av_freep(&fmts->list);                              \
+                av_freep(&fmts);                                    \
                 return ret;                                         \
             }                                                       \
             count++;                                                \