History

avfilter/af_anequalizer: Fix memleak when inserting pad fails

It has been forgotten to free the name of the second outpad if attaching the first one to the AVFilterContext fails. Fixing this is easy: Only prepare the second outpad after (and if) the first outpad has been successfully attached to the AVFilterContext.

Andreas Rheinhardt committed 6 years ago

Commit fdbd5791 parent 4aac7421 file · +6 −10Browse files

Unified · Split

libavfilter/af_anequalizer.c+6−10
@@ -199,6 +199,12 @@ static av_cold int init(AVFilterContext *ctx) · 198 unmodified lines
199199 if (!pad.name)
200200 return AVERROR(ENOMEM);
201201
202+ ret = ff_insert_outpad(ctx, 0, &pad);
203+ if (ret < 0) {
204+ av_freep(&pad.name);
205+ return ret;
206+ }
207+
202208 if (s->draw_curves) {
203209 vpad = (AVFilterPad){
204210 .name = av_strdup("out1"),
@@ -206,18 +212,8 @@ static av_cold int init(AVFilterContext *ctx) · 1 unmodified line
206212 .config_props = config_video,
207213 };
208214 if (!vpad.name) {
209− av_freep(&pad.name);
210215 return AVERROR(ENOMEM);
211216 }
212− }
213−
214− ret = ff_insert_outpad(ctx, 0, &pad);
215− if (ret < 0) {
216− av_freep(&pad.name);
217− return ret;
218− }
219−
220− if (s->draw_curves) {
221217 ret = ff_insert_outpad(ctx, 1, &vpad);
222218 if (ret < 0) {
223219 av_freep(&vpad.name);

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