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

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_signature.c+4−5
@@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx) · 662 unmodified lines
663 663
664 if (!pad.name)664 if (!pad.name)
665 return AVERROR(ENOMEM);665 return AVERROR(ENOMEM);
666 if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
667 av_freep(&pad.name);
668 return ret;
669 }
666 670
667 sc = &(sic->streamcontexts[i]);671 sc = &(sic->streamcontexts[i]);
668 672
@@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx) · 10 unmodified lines
679 sc->coarseend = sc->coarsesiglist;683 sc->coarseend = sc->coarsesiglist;
680 sc->coarsecount = 0;684 sc->coarsecount = 0;
681 sc->midcoarse = 0;685 sc->midcoarse = 0;
682
683 if ((ret = ff_insert_inpad(ctx, i, &pad)) < 0) {
684 av_freep(&pad.name);
685 return ret;
686 }
687 }686 }
688 687
689 /* check filename */688 /* 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