]> git.puffer.fish Git - mirror/frr.git/commitdiff
mgmtd: fix a couple compilation warnings. 16602/head
authorChristian Hopps <chopps@labn.net>
Sun, 18 Aug 2024 10:33:29 +0000 (05:33 -0500)
committerChristian Hopps <chopps@labn.net>
Sun, 18 Aug 2024 10:33:29 +0000 (05:33 -0500)
Also an empty (thus non-replace) notify selectors message shouldn't
clear the selectors, it should just do nothing.

Signed-off-by: Christian Hopps <chopps@labn.net>
lib/mgmt_be_client.c
mgmtd/mgmt_fe_adapter.c

index 6e2fb05e846effc3f2736b03ce1106d732abcc57..49879f3f5334b5eb62e235154c0587d7ba60a25b 100644 (file)
@@ -1061,7 +1061,7 @@ static void be_client_handle_notify(struct mgmt_be_client *client, void *msgbuf,
        struct mgmt_msg_notify_data *notif_msg = msgbuf;
        struct nb_node *nb_node;
        struct lyd_node *dnode;
-       const char *data;
+       const char *data = NULL;
        const char *notif;
        LY_ERR err;
 
index 5f53c928a47e07929851111742ca305f8a5b5484..09d1910cee612e46ebf797b6457973ef85f254e3 100644 (file)
@@ -1518,7 +1518,6 @@ static void fe_adapter_handle_notify_select(struct mgmt_fe_session_ctx *session,
        const char **selectors = NULL;
        const char **new;
 
-       /* An empty message clears the selectors */
        if (msg_len >= sizeof(*msg)) {
                selectors = mgmt_msg_native_strings_decode(msg, msg_len,
                                                           msg->selectors);
@@ -1531,7 +1530,7 @@ static void fe_adapter_handle_notify_select(struct mgmt_fe_session_ctx *session,
        if (msg->replace) {
                darr_free_free(session->notify_xpaths);
                session->notify_xpaths = selectors;
-       } else {
+       } else if (selectors) {
                new = darr_append_nz(session->notify_xpaths,
                                     darr_len(selectors));
                memcpy(new, selectors, darr_len(selectors) * sizeof(*selectors));