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: OISF#7270
  • Loading branch information
jtstrs authored and victorjulien committed Oct 2, 2024
1 parent 592d860 commit c72404e
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 @@ -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, '_')) {
Expand Down

0 comments on commit c72404e

Please sign in to comment.