These names are always the same, so not using duplicates saves allocations, checks for the allocations as well as frees.
Unified · Split
| @@ -192,33 +192,23 @@ static av_cold int init(AVFilterContext *ctx) · 191 unmodified lines | ||
| 192 | 192 | int ret; |
| 193 | 193 | |
| 194 | 194 | pad = (AVFilterPad){ |
| 195 | − .name = av_strdup("out0"), | |
| 195 | + .name = "out0", | |
| 196 | 196 | .type = AVMEDIA_TYPE_AUDIO, |
| 197 | 197 | }; |
| 198 | 198 | |
| 199 | − if (!pad.name) | |
| 200 | − return AVERROR(ENOMEM); | |
| 201 | − | |
| 202 | 199 | ret = ff_insert_outpad(ctx, 0, &pad); |
| 203 | − if (ret < 0) { | |
| 204 | − av_freep(&pad.name); | |
| 200 | + if (ret < 0) | |
| 205 | 201 | return ret; |
| 206 | − } | |
| 207 | 202 | |
| 208 | 203 | if (s->draw_curves) { |
| 209 | 204 | vpad = (AVFilterPad){ |
| 210 | − .name = av_strdup("out1"), | |
| 205 | + .name = "out1", | |
| 211 | 206 | .type = AVMEDIA_TYPE_VIDEO, |
| 212 | 207 | .config_props = config_video, |
| 213 | 208 | }; |
| 214 | − if (!vpad.name) { | |
| 215 | − return AVERROR(ENOMEM); | |
| 216 | − } | |
| 217 | 209 | ret = ff_insert_outpad(ctx, 1, &vpad); |
| 218 | − if (ret < 0) { | |
| 219 | − av_freep(&vpad.name); | |
| 210 | + if (ret < 0) | |
| 220 | 211 | return ret; |
| 221 | − } | |
| 222 | 212 | } |
| 223 | 213 | |
| 224 | 214 | return 0; |
| @@ -267,8 +257,6 @@ static av_cold void uninit(AVFilterContext *ctx) · 42 unmodified lines | ||
| 267 | 257 | { |
| 268 | 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 | 260 | av_frame_free(&s->video); |
| 273 | 261 | av_freep(&s->filters); |
| 274 | 262 | s->nb_filters = 0; |