diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-21 22:09:03 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-01-21 22:40:14 +0100 |
commit | e740e9c79807b9d0174c037a6b3062b7057d436b (patch) | |
tree | c6e94ae641d7fd5abf5c0a2426318108ff1e04e5 | |
parent | d60f090dd187ef8cdd64c556f4820491f1caa23d (diff) | |
download | ffmpeg-e740e9c79807b9d0174c037a6b3062b7057d436b.tar.gz |
avfilter/vf_palettegen: Fix leak and simplify code
Fixes CID1270818
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavfilter/vf_palettegen.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libavfilter/vf_palettegen.c b/libavfilter/vf_palettegen.c index 668a4aee22..5e69873b4c 100644 --- a/libavfilter/vf_palettegen.c +++ b/libavfilter/vf_palettegen.c @@ -95,15 +95,10 @@ static int query_formats(AVFilterContext *ctx) static const enum AVPixelFormat in_fmts[] = {AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE}; static const enum AVPixelFormat out_fmts[] = {AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE}; int ret; - AVFilterFormats *in = ff_make_format_list(in_fmts); - AVFilterFormats *out = ff_make_format_list(out_fmts); - if (!in || !out) { - av_freep(&in); - av_freep(&out); - return AVERROR(ENOMEM); - } - if ((ret = ff_formats_ref(in , &ctx->inputs[0]->out_formats)) < 0 || - (ret = ff_formats_ref(out, &ctx->outputs[0]->in_formats)) < 0) + + if ((ret = ff_formats_ref(ff_make_format_list(in_fmts) , &ctx->inputs[0]->out_formats)) < 0) + return ret; + if ((ret = ff_formats_ref(ff_make_format_list(out_fmts), &ctx->outputs[0]->in_formats)) < 0) return ret; return 0; } |