diff --git a/libavfilter/af_amix.c b/libavfilter/af_amix.c
index e40969f70cf7335c11b3953c6b97b083850e265e..fd9d13556f3328e26ea0181bf290af00bb53cf8d 100644
--- a/libavfilter/af_amix.c
+++ b/libavfilter/af_amix.c
@@ -496,6 +496,8 @@ static av_cold int init(AVFilterContext *ctx)
         snprintf(name, sizeof(name), "input%d", i);
         pad.type           = AVMEDIA_TYPE_AUDIO;
         pad.name           = av_strdup(name);
+        if (!pad.name)
+            return AVERROR(ENOMEM);
         pad.filter_frame   = filter_frame;
 
         ff_insert_inpad(ctx, i, &pad);
diff --git a/libavfilter/af_join.c b/libavfilter/af_join.c
index a1717c63b9f097db433b0689d0aa1c0523f41aef..71a454bba7ed6291b6cf4e0c37d97ccc23d0f01c 100644
--- a/libavfilter/af_join.c
+++ b/libavfilter/af_join.c
@@ -214,6 +214,8 @@ static av_cold int join_init(AVFilterContext *ctx)
         snprintf(name, sizeof(name), "input%d", i);
         pad.type           = AVMEDIA_TYPE_AUDIO;
         pad.name           = av_strdup(name);
+        if (!pad.name)
+            return AVERROR(ENOMEM);
         pad.filter_frame   = filter_frame;
 
         pad.needs_fifo = 1;
diff --git a/libavfilter/split.c b/libavfilter/split.c
index 6abd5ee2e0cb07a1efc94d07cf03e213ecc7b69a..735381067732306dbc660774568cda14b541eb9b 100644
--- a/libavfilter/split.c
+++ b/libavfilter/split.c
@@ -52,6 +52,8 @@ static av_cold int split_init(AVFilterContext *ctx)
         snprintf(name, sizeof(name), "output%d", i);
         pad.type = ctx->filter->inputs[0].type;
         pad.name = av_strdup(name);
+        if (!pad.name)
+            return AVERROR(ENOMEM);
 
         ff_insert_outpad(ctx, i, &pad);
     }
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index 0b97b827e49bd71d5a737cd954e4996b4c4b5b39..908c03e1d338bb0ca40017c804c6689fe27af08b 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -289,6 +289,8 @@ static av_cold int movie_common_init(AVFilterContext *ctx)
         snprintf(name, sizeof(name), "out%d", i);
         pad.type          = movie->st[i].st->codec->codec_type;
         pad.name          = av_strdup(name);
+        if (!pad.name)
+            return AVERROR(ENOMEM);
         pad.config_props  = movie_config_output_props;
         pad.request_frame = movie_request_frame;
         ff_insert_outpad(ctx, i, &pad);