Message ID | 20200825140927.16433-16-andreas.rheinhardt@gmail.com |
---|---|
State | Accepted |
Commit | 16ea88778e6f4e2d49318ea6e02fa938ac2f401e |
Headers | show |
Series | [FFmpeg-devel,01/19] avfilter/avfilter: Fix indentation | expand |
Context | Check | Description |
---|---|---|
andriy/default | pending | |
andriy/make | success | Make finished |
andriy/make_fate | success | Make fate finished |
On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt@gmail.com> wrote: > If an error happens between allocating a string intended to be used as > an inpad's name and attaching it to its input pad, the string leaks. > Fix this by inserting the inpad directly after allocating its string. > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> > --- > libavfilter/vf_signature.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > LGTM > diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c > index d09003746c..80957d0047 100644 > --- a/libavfilter/vf_signature.c > +++ b/libavfilter/vf_signature.c > @@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx) > > if (!pad.name) > return AVERROR(ENOMEM); > + if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { > + av_freep(&pad.name); > + return ret; > + } > > sc = &(sic->streamcontexts[i]); > > @@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx) > sc->coarseend = sc->coarsesiglist; > sc->coarsecount = 0; > sc->midcoarse = 0; > - > - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { > - av_freep(&pad.name); > - return ret; > - } > } > > /* check filename */ > -- > 2.20.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c index d09003746c..80957d0047 100644 --- a/libavfilter/vf_signature.c +++ b/libavfilter/vf_signature.c @@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx) if (!pad.name) return AVERROR(ENOMEM); + if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { + av_freep(&pad.name); + return ret; + } sc = &(sic->streamcontexts[i]); @@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx) sc->coarseend = sc->coarsesiglist; sc->coarsecount = 0; sc->midcoarse = 0; - - if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) { - av_freep(&pad.name); - return ret; - } } /* check filename */
If an error happens between allocating a string intended to be used as an inpad's name and attaching it to its input pad, the string leaks. Fix this by inserting the inpad directly after allocating its string. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavfilter/vf_signature.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)