Skip to content

Commit

Permalink
Merge pull request #14789 from FRRouting/mergify/bp/stable/9.1/pr-14767
Browse files Browse the repository at this point in the history
lib: fix possible freeing of libyang data (backport #14767)
  • Loading branch information
ton31337 authored Nov 14, 2023
2 parents 3fba3d5 + c720f9c commit de60785
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/northbound.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ void nb_candidate_edit_config_changes(
struct nb_cfg_change *change = &cfg_changes[i];
struct nb_node *nb_node;
char xpath[XPATH_MAXLEN];
const char *value;
struct yang_data *data;
int ret;

Expand Down Expand Up @@ -879,9 +880,10 @@ void nb_candidate_edit_config_changes(
}

/* If the value is not set, get the default if it exists. */
if (change->value == NULL)
change->value = yang_snode_get_default(nb_node->snode);
data = yang_data_new(xpath, change->value);
value = change->value;
if (value == NULL)
value = yang_snode_get_default(nb_node->snode);
data = yang_data_new(xpath, value);

/*
* Ignore "not found" errors when editing the candidate
Expand Down

0 comments on commit de60785

Please sign in to comment.