aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-25 00:20:35 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-08-26 23:52:56 +0200
commit16ea88778e6f4e2d49318ea6e02fa938ac2f401e (patch)
tree320f9486c0be41534fe3dd07b08654f51862be2a /libavfilter
parent37838417b8045fa3a49acc55546c741d3f2ac602 (diff)
downloadffmpeg-16ea88778e6f4e2d49318ea6e02fa938ac2f401e.tar.gz
avfilter/vf_signature: Fix leak of string upon error
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. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_signature.c9
1 files changed, 4 insertions, 5 deletions
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 */