Commit 9a53e012 authored by Paul B Mahol's avatar Paul B Mahol

avfilter/formats: guard against double free

parent c303d097
...@@ -456,7 +456,7 @@ do { \ ...@@ -456,7 +456,7 @@ do { \
do { \ do { \
int idx = -1; \ int idx = -1; \
\ \
if (!*ref || !(*ref)->refs) \ if (!ref || !*ref || !(*ref)->refs) \
return; \ return; \
\ \
FIND_REF_INDEX(ref, idx); \ FIND_REF_INDEX(ref, idx); \
...@@ -518,6 +518,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) ...@@ -518,6 +518,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts); \ int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts); \
if (ret < 0) { \ if (ret < 0) { \
unref_fn(&fmts); \ unref_fn(&fmts); \
if (fmts) \
av_freep(&fmts->list); \ av_freep(&fmts->list); \
av_freep(&fmts); \ av_freep(&fmts); \
return ret; \ return ret; \
...@@ -530,6 +531,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref) ...@@ -530,6 +531,7 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts); \ int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts); \
if (ret < 0) { \ if (ret < 0) { \
unref_fn(&fmts); \ unref_fn(&fmts); \
if (fmts) \
av_freep(&fmts->list); \ av_freep(&fmts->list); \
av_freep(&fmts); \ av_freep(&fmts); \
return ret; \ return ret; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment