mirror of https://git.ffmpeg.org/ffmpeg.git
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. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
fdbd579fd1
commit
080d2c67f5
|
@ -192,33 +192,23 @@ static av_cold int init(AVFilterContext *ctx)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pad = (AVFilterPad){
|
pad = (AVFilterPad){
|
||||||
.name = av_strdup("out0"),
|
.name = "out0",
|
||||||
.type = AVMEDIA_TYPE_AUDIO,
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!pad.name)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
ret = ff_insert_outpad(ctx, 0, &pad);
|
ret = ff_insert_outpad(ctx, 0, &pad);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
av_freep(&pad.name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
|
|
||||||
if (s->draw_curves) {
|
if (s->draw_curves) {
|
||||||
vpad = (AVFilterPad){
|
vpad = (AVFilterPad){
|
||||||
.name = av_strdup("out1"),
|
.name = "out1",
|
||||||
.type = AVMEDIA_TYPE_VIDEO,
|
.type = AVMEDIA_TYPE_VIDEO,
|
||||||
.config_props = config_video,
|
.config_props = config_video,
|
||||||
};
|
};
|
||||||
if (!vpad.name) {
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
}
|
|
||||||
ret = ff_insert_outpad(ctx, 1, &vpad);
|
ret = ff_insert_outpad(ctx, 1, &vpad);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
av_freep(&vpad.name);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -267,8 +257,6 @@ static av_cold void uninit(AVFilterContext *ctx)
|
||||||
{
|
{
|
||||||
AudioNEqualizerContext *s = ctx->priv;
|
AudioNEqualizerContext *s = ctx->priv;
|
||||||
|
|
||||||
for (int i = 0; i < ctx->nb_outputs; i++)
|
|
||||||
av_freep(&ctx->output_pads[i].name);
|
|
||||||
av_frame_free(&s->video);
|
av_frame_free(&s->video);
|
||||||
av_freep(&s->filters);
|
av_freep(&s->filters);
|
||||||
s->nb_filters = 0;
|
s->nb_filters = 0;
|
||||||
|
|
Loading…
Reference in New Issue