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.
Unified · Split
| @@ -663,6 +663,10 @@ static av_cold int init(AVFilterContext *ctx) · 662 unmodified lines | ||
| 663 | 663 | |
| 664 | 664 | if (!pad.name) |
| 665 | 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 | 671 | sc = &(sic->streamcontexts[i]); |
| 668 | 672 | |
| @@ -679,11 +683,6 @@ static av_cold int init(AVFilterContext *ctx) · 10 unmodified lines | ||
| 679 | 683 | sc->coarseend = sc->coarsesiglist; |
| 680 | 684 | sc->coarsecount = 0; |
| 681 | 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 | 688 | /* check filename */ |