X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Fformats.c;h=33c64668a0b9564c153ed0a60da2666d10f3f1c4;hb=619f5308122beb166b750ff6084c734d822b7de4;hp=31ee445c494ee38fdd75b6e6517274ed70a31a6e;hpb=c2631dfd0a0a12050cc1765fd41702c5e93abee5;p=ffmpeg diff --git a/libavfilter/formats.c b/libavfilter/formats.c index 31ee445c494..33c64668a0b 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -317,7 +317,6 @@ do { \ void *oldf = *f; \ \ if (!(*f) && !(*f = av_mallocz(sizeof(**f)))) { \ - unref_fn(f); \ return AVERROR(ENOMEM); \ } \ \ @@ -456,7 +455,7 @@ do { \ do { \ int idx = -1; \ \ - if (!*ref || !(*ref)->refs) \ + if (!ref || !*ref || !(*ref)->refs) \ return; \ \ FIND_REF_INDEX(ref, idx); \ @@ -518,7 +517,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 +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); \ + if (fmts) \ + av_freep(&fmts->list); \ av_freep(&fmts); \ return ret; \ } \