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

Unified · Split

libavfilter/af_anequalizer.c+4−16
@@ -192,33 +192,23 @@ static av_cold int init(AVFilterContext *ctx) · 191 unmodified lines
192 int ret;192 int ret;
193 193
194 pad = (AVFilterPad){194 pad = (AVFilterPad){
195 .name = av_strdup("out0"),195 .name = "out0",
196 .type = AVMEDIA_TYPE_AUDIO,196 .type = AVMEDIA_TYPE_AUDIO,
197 };197 };
198 198
199 if (!pad.name)
200 return AVERROR(ENOMEM);
201
202 ret = ff_insert_outpad(ctx, 0, &pad);199 ret = ff_insert_outpad(ctx, 0, &pad);
203 if (ret < 0) {200 if (ret < 0)
204 av_freep(&pad.name);
205 return ret;201 return ret;
206 }
207 202
208 if (s->draw_curves) {203 if (s->draw_curves) {
209 vpad = (AVFilterPad){204 vpad = (AVFilterPad){
210 .name = av_strdup("out1"),205 .name = "out1",
211 .type = AVMEDIA_TYPE_VIDEO,206 .type = AVMEDIA_TYPE_VIDEO,
212 .config_props = config_video,207 .config_props = config_video,
213 };208 };
214 if (!vpad.name) {
215 return AVERROR(ENOMEM);
216 }
217 ret = ff_insert_outpad(ctx, 1, &vpad);209 ret = ff_insert_outpad(ctx, 1, &vpad);
218 if (ret < 0) {210 if (ret < 0)
219 av_freep(&vpad.name);
220 return ret;211 return ret;
221 }
222 }212 }
223 213
224 return 0;214 return 0;
@@ -267,8 +257,6 @@ static av_cold void uninit(AVFilterContext *ctx) · 42 unmodified lines
267{257{
268 AudioNEqualizerContext *s = ctx->priv;258 AudioNEqualizerContext *s = ctx->priv;
269 259
270 for (int i = 0; i < ctx->nb_outputs; i++)
271 av_freep(&ctx->output_pads[i].name);
272 av_frame_free(&s->video);260 av_frame_free(&s->video);
273 av_freep(&s->filters);261 av_freep(&s->filters);
274 s->nb_filters = 0;262 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