Message ID | 20170330213448.3806-1-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | 5036e214b0e1028e035d628f7e7f89cb1ba6a0d6 |
Headers | show |
On 3/30/17, Michael Niedermayer <michael@niedermayer.cc> wrote: > Fixes: CID1398578 > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavfilter/vf_zoompan.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c > index 136d6c83fd..53a0700e37 100644 > --- a/libavfilter/vf_zoompan.c > +++ b/libavfilter/vf_zoompan.c > @@ -191,7 +191,7 @@ static int output_single_frame(AVFilterContext *ctx, > AVFrame *in, double *var_va > s->sws = sws_alloc_context(); > if (!s->sws) { > ret = AVERROR(ENOMEM); > - return ret; > + goto error; > } > > for (k = 0; in->data[k]; k++) > @@ -206,7 +206,7 @@ static int output_single_frame(AVFilterContext *ctx, > AVFrame *in, double *var_va > av_opt_set_int(s->sws, "sws_flags", SWS_BICUBIC, 0); > > if ((ret = sws_init_context(s->sws, NULL, NULL)) < 0) > - return ret; > + goto error; > > sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, > out->data, out->linesize); > > @@ -218,6 +218,9 @@ static int output_single_frame(AVFilterContext *ctx, > AVFrame *in, double *var_va > s->sws = NULL; > s->current_frame++; > return ret; > +error: > + av_frame_free(&out); > + return ret; > } > > static int filter_frame(AVFilterLink *inlink, AVFrame *in) > -- > 2.11.0 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > lgtm
On Fri, Mar 31, 2017 at 10:07:24AM +0200, Paul B Mahol wrote: > On 3/30/17, Michael Niedermayer <michael@niedermayer.cc> wrote: > > Fixes: CID1398578 > > > > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > > --- > > libavfilter/vf_zoompan.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c > > index 136d6c83fd..53a0700e37 100644 > > --- a/libavfilter/vf_zoompan.c > > +++ b/libavfilter/vf_zoompan.c > > @@ -191,7 +191,7 @@ static int output_single_frame(AVFilterContext *ctx, > > AVFrame *in, double *var_va > > s->sws = sws_alloc_context(); > > if (!s->sws) { > > ret = AVERROR(ENOMEM); > > - return ret; > > + goto error; > > } > > > > for (k = 0; in->data[k]; k++) > > @@ -206,7 +206,7 @@ static int output_single_frame(AVFilterContext *ctx, > > AVFrame *in, double *var_va > > av_opt_set_int(s->sws, "sws_flags", SWS_BICUBIC, 0); > > > > if ((ret = sws_init_context(s->sws, NULL, NULL)) < 0) > > - return ret; > > + goto error; > > > > sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, > > out->data, out->linesize); > > > > @@ -218,6 +218,9 @@ static int output_single_frame(AVFilterContext *ctx, > > AVFrame *in, double *var_va > > s->sws = NULL; > > s->current_frame++; > > return ret; > > +error: > > + av_frame_free(&out); > > + return ret; > > } > > > > static int filter_frame(AVFilterLink *inlink, AVFrame *in) > > -- > > 2.11.0 > > > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > lgtm applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable
diff --git a/libavfilter/vf_zoompan.c b/libavfilter/vf_zoompan.c index 136d6c83fd..53a0700e37 100644 --- a/libavfilter/vf_zoompan.c +++ b/libavfilter/vf_zoompan.c @@ -191,7 +191,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va s->sws = sws_alloc_context(); if (!s->sws) { ret = AVERROR(ENOMEM); - return ret; + goto error; } for (k = 0; in->data[k]; k++) @@ -206,7 +206,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va av_opt_set_int(s->sws, "sws_flags", SWS_BICUBIC, 0); if ((ret = sws_init_context(s->sws, NULL, NULL)) < 0) - return ret; + goto error; sws_scale(s->sws, (const uint8_t *const *)&input, in->linesize, 0, h, out->data, out->linesize); @@ -218,6 +218,9 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va s->sws = NULL; s->current_frame++; return ret; +error: + av_frame_free(&out); + return ret; } static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Fixes: CID1398578 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavfilter/vf_zoompan.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)