diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-11-14 13:11:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-14 13:11:39 +0200 |
| commit | de607853c874bf2f19a44bb6570538b83dcef6e9 (patch) | |
| tree | 359a49f0364fc9bb534f08feb8c03d857fbb3e51 | |
| parent | 3fba3d5d4faa55df29359068c808049e891c8826 (diff) | |
| parent | c720f9cdb7cec46a583a9e47d39e882d741d259b (diff) | |
Merge pull request #14789 from FRRouting/mergify/bp/stable/9.1/pr-14767
lib: fix possible freeing of libyang data (backport #14767)
| -rw-r--r-- | lib/northbound.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/northbound.c b/lib/northbound.c index 69b96d3656..6ff5c24bd1 100644 --- a/lib/northbound.c +++ b/lib/northbound.c @@ -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; @@ -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 |
