This defect was found by the coccinelle script "unchecked-strdup.cocci".
It can be backported to all supported branches.
---
src/namespace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/namespace.c b/src/namespace.c
index 9cc85a384..12885cd9f 100644
--- a/src/namespace.c
+++ b/src/namespace.c
@@ -92,6 +92,11 @@ struct netns_entry* netns_store_insert(const char *ns_name)
goto out;
entry->fd = fd;
entry->node.key = strdup(ns_name);
+ if (!entry->node.key) {
+ free(entry);
+ entry = NULL;
+ goto out;
+ }
entry->name_len = strlen(ns_name);
ebis_insert(&namespace_tree_root, &entry->node);
out:
--
2.47.0