History

avfilter/af_anequalizer: Don't allocate outpad names

These names are always the same, so not using duplicates saves allocations, checks for the allocations as well as frees.

Andreas Rheinhardt committed 6 years ago

Commit 080d2c61 parent fdbd5791 file · +4 −16Browse files

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

Unified · Split

libavfilter/af_anequalizer.c+4−16
@@ -192,33 +192,23 @@ static av_cold int init(AVFilterContext *ctx) · 191 unmodified lines
192192 int ret;
193193
194194 pad = (AVFilterPad){
195− .name = av_strdup("out0"),
195+ .name = "out0",
196196 .type = AVMEDIA_TYPE_AUDIO,
197197 };
198198
199− if (!pad.name)
200− return AVERROR(ENOMEM);
201−
202199 ret = ff_insert_outpad(ctx, 0, &pad);
203− if (ret < 0) {
204− av_freep(&pad.name);
200+ if (ret < 0)
205201 return ret;
206− }
207202
208203 if (s->draw_curves) {
209204 vpad = (AVFilterPad){
210− .name = av_strdup("out1"),
205+ .name = "out1",
211206 .type = AVMEDIA_TYPE_VIDEO,
212207 .config_props = config_video,
213208 };
214− if (!vpad.name) {
215− return AVERROR(ENOMEM);
216− }
217209 ret = ff_insert_outpad(ctx, 1, &vpad);
218− if (ret < 0) {
219− av_freep(&vpad.name);
210+ if (ret < 0)
220211 return ret;
221− }
222212 }
223213
224214 return 0;
@@ -267,8 +257,6 @@ static av_cold void uninit(AVFilterContext *ctx) · 42 unmodified lines
267257 {
268258 AudioNEqualizerContext *s = ctx->priv;
269259
270− for (int i = 0; i < ctx->nb_outputs; i++)
271− av_freep(&ctx->output_pads[i].name);
272260 av_frame_free(&s->video);
273261 av_freep(&s->filters);
274262 s->nb_filters = 0;

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