History

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.

Andreas Rheinhardt committed 6 years ago

Commit 16ea8871 parent 37838411 file · +4 −5Browse files

Unified · Split

libavfilter/vf_signature.c+4−5
@@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx) · 662 unmodified lines
663663
664664 if (!pad.name)
665665 return AVERROR(ENOMEM);
666+ if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
667+ av_freep(&pad.name);
668+ return ret;
669+ }
666670
667671 sc = &(sic->streamcontexts[i]);
668672
@@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx) · 10 unmodified lines
679683 sc->coarseend = sc->coarsesiglist;
680684 sc->coarsecount = 0;
681685 sc->midcoarse = 0;
682−
683− if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
684− av_freep(&pad.name);
685− return ret;
686− }
687686 }
688687
689688 /* check filename */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t