From c72404e5546635a6239bdd7302fe945f47ce1927 Mon Sep 17 00:00:00 2001 From: Alexey Simakov Date: Mon, 23 Sep 2024 21:24:48 +0300 Subject: [PATCH] yaml: Add check of allocation for node object Fix potential dereference of nullptr in case of unsuccessful allocation of memory for list node Bug: #7270 --- src/conf-yaml-loader.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/conf-yaml-loader.c b/src/conf-yaml-loader.c index f8b9ae21232a..f70a5f04e88e 100644 --- a/src/conf-yaml-loader.c +++ b/src/conf-yaml-loader.c @@ -330,6 +330,9 @@ static int ConfYamlParse(yaml_parser_t *parser, ConfNode *parent, int inseq, int node = existing; } else { node = ConfNodeNew(); + if (unlikely(node == NULL)) { + goto fail; + } node->name = SCStrdup(value); node->parent = parent; if (node->name && strchr(node->name, '_')) {