Skip to content

Commit

Permalink
yaml: Add check of allocation for node object
Browse files Browse the repository at this point in the history
Fix potential dereference of nullptr in case
of unsuccessful allocation of memory for
list node

Bug: #7270
(cherry picked from commit c72404e)
  • Loading branch information
jtstrs authored and jufajardini committed Oct 15, 2024
1 parent 09d3ff9 commit 32f6b5b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/conf-yaml-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,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, '_')) {
Expand Down

0 comments on commit 32f6b5b

Please sign in to comment.