diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-22 04:33:58 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-08-26 23:52:56 +0200 |
commit | 281b8187e355b42f86b7a62f0fe93e6093484051 (patch) | |
tree | f2f5e24f9d5df8da573aadabb58236bb601ebc5d | |
parent | 3ac3f393145f67e7dc0f8da2cc1ac9365befc3a8 (diff) | |
download | ffmpeg-281b8187e355b42f86b7a62f0fe93e6093484051.tar.gz |
avfilter/avf_aphasemeter: 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>
-rw-r--r-- | libavfilter/avf_aphasemeter.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/libavfilter/avf_aphasemeter.c b/libavfilter/avf_aphasemeter.c index be0b2fb70f..53d1de29d3 100644 --- a/libavfilter/avf_aphasemeter.c +++ b/libavfilter/avf_aphasemeter.c @@ -227,11 +227,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) static av_cold void uninit(AVFilterContext *ctx) { AudioPhaseMeterContext *s = ctx->priv; - int i; av_frame_free(&s->out); - for (i = 0; i < ctx->nb_outputs; i++) - av_freep(&ctx->output_pads[i].name); } static av_cold int init(AVFilterContext *ctx) @@ -241,30 +238,22 @@ static av_cold int init(AVFilterContext *ctx) int ret; pad = (AVFilterPad){ - .name = av_strdup("out0"), + .name = "out0", .type = AVMEDIA_TYPE_AUDIO, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, 0, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } if (s->do_video) { pad = (AVFilterPad){ - .name = av_strdup("out1"), + .name = "out1", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_video_output, }; - if (!pad.name) - return AVERROR(ENOMEM); ret = ff_insert_outpad(ctx, 1, &pad); - if (ret < 0) { - av_freep(&pad.name); + if (ret < 0) return ret; - } } return 0; |