]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: do not attempt to create default nodes from NULL tree node 8858/head
authorChristian Hopps <chopps@labn.net>
Fri, 11 Jun 2021 13:18:24 +0000 (13:18 +0000)
committermergify-bot <noreply@mergify.io>
Tue, 15 Jun 2021 09:27:00 +0000 (09:27 +0000)
Perform same NULL check for dependent node creation code too.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 4da08e016b5753558ffe61db532af8a2f9b6a8a5)

lib/northbound.c

index 47af77018959d803e3889ed6ff17c34f0c32da3f..6edd5184efd9b37bffd07f21b255b64ee883c03d 100644 (file)
@@ -696,14 +696,14 @@ int nb_candidate_edit(struct nb_config *candidate,
                                                   NULL, LYD_NEW_PATH_UPDATE,
                                                   &dep_dnode);
                                /* Create default nodes */
-                               if (!err)
+                               if (!err && dep_dnode)
                                        err = lyd_new_implicit_tree(
                                                dep_dnode,
                                                LYD_IMPLICIT_NO_STATE, NULL);
                                if (err) {
                                        flog_warn(
                                                EC_LIB_LIBYANG,
-                                               "%s: lyd_new_path(%s) failed: %d",
+                                               "%s: dependency: lyd_new_path(%s) failed: %d",
                                                __func__, dep_xpath, err);
                                        return NB_ERR;
                                }