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

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

Unified · Split

libavfilter/af_anequalizer.c+6−10
@@ -199,6 +199,12 @@ static av_cold int init(AVFilterContext *ctx) · 198 unmodified lines
199 if (!pad.name)199 if (!pad.name)
200 return AVERROR(ENOMEM);200 return AVERROR(ENOMEM);
201 201
202 ret = ff_insert_outpad(ctx, 0, &pad);
203 if (ret < 0) {
204 av_freep(&pad.name);
205 return ret;
206 }
207
202 if (s->draw_curves) {208 if (s->draw_curves) {
203 vpad = (AVFilterPad){209 vpad = (AVFilterPad){
204 .name = av_strdup("out1"),210 .name = av_strdup("out1"),
@@ -206,18 +212,8 @@ static av_cold int init(AVFilterContext *ctx) · 1 unmodified line
206 .config_props = config_video,212 .config_props = config_video,
207 };213 };
208 if (!vpad.name) {214 if (!vpad.name) {
209 av_freep(&pad.name);
210 return AVERROR(ENOMEM);215 return AVERROR(ENOMEM);
211 }216 }
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) {
221 ret = ff_insert_outpad(ctx, 1, &vpad);217 ret = ff_insert_outpad(ctx, 1, &vpad);
222 if (ret < 0) {218 if (ret < 0) {
223 av_freep(&vpad.name);219 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