summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-10-07 17:26:59 +0200
committerPaul B Mahol <onemda@gmail.com>2019-10-07 17:26:59 +0200
commit9a53e0125290238db66034f67a9c41c420264c09 (patch)
tree4b754d7a5fc1e2c030eac68aeb3ec2385bde9d1c /libavfilter
parentc303d0979fb050008974182784b633e8184f0be7 (diff)
avfilter/formats: guard against double free
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/formats.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index 31ee445c49..e6d27f45f3 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -456,7 +456,7 @@ do { \
do { \
int idx = -1; \
\
- if (!*ref || !(*ref)->refs) \
+ if (!ref || !*ref || !(*ref)->refs) \
return; \
\
FIND_REF_INDEX(ref, idx); \
@@ -518,7 +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); \
+ if (fmts) \
+ av_freep(&fmts->list); \
av_freep(&fmts); \
return ret; \
} \
@@ -530,7 +531,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); \
+ if (fmts) \
+ av_freep(&fmts->list); \
av_freep(&fmts); \
return ret; \
} \