History

avfilter/vf_fieldmatch: Don't allocate inpad 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 2d349631 parent 7e736cd1 file · +4 −15Browse files

Unified · Split

libavfilter/vf_fieldmatch.c+4−15
@@ -964,28 +964,20 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx) · 963 unmodified lines
964964 {
965965 const FieldMatchContext *fm = ctx->priv;
966966 AVFilterPad pad = {
967− .name = av_strdup("main"),
967+ .name = "main",
968968 .type = AVMEDIA_TYPE_VIDEO,
969969 .config_props = config_input,
970970 };
971971 int ret;
972972
973− if (!pad.name)
974− return AVERROR(ENOMEM);
975− if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0) {
976− av_freep(&pad.name);
973+ if ((ret = ff_insert_inpad(ctx, INPUT_MAIN, &pad)) < 0)
977974 return ret;
978− }
979975
980976 if (fm->ppsrc) {
981− pad.name = av_strdup("clean_src");
977+ pad.name = "clean_src";
982978 pad.config_props = NULL;
983− if (!pad.name)
984− return AVERROR(ENOMEM);
985− if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0) {
986− av_freep(&pad.name);
979+ if ((ret = ff_insert_inpad(ctx, INPUT_CLEANSRC, &pad)) < 0)
987980 return ret;
988− }
989981 }
990982
991983 if ((fm->blockx & (fm->blockx - 1)) ||
@@ -1004,7 +996,6 @@ static av_cold int fieldmatch_init(AVFilterContext *ctx) · 12 unmodified lines
1004996
1005997 static av_cold void fieldmatch_uninit(AVFilterContext *ctx)
1006998 {
1007− int i;
1008999 FieldMatchContext *fm = ctx->priv;
10091000
10101001 if (fm->prv != fm->src)
@@ -1021,8 +1012,6 @@ static av_cold void fieldmatch_uninit(AVFilterContext *ctx) · 10 unmodified lines
10211012 av_freep(&fm->cmask_data[0]);
10221013 av_freep(&fm->tbuffer);
10231014 av_freep(&fm->c_array);
1024− for (i = 0; i < ctx->nb_inputs; i++)
1025− av_freep(&ctx->input_pads[i].name);
10261015 }
10271016
10281017 static int config_output(AVFilterLink *outlink)

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