]> git.puffer.fish Git - mirror/frr.git/commitdiff
mgmtd: xpath is already NULL in the failure path 13646/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 31 May 2023 11:54:10 +0000 (07:54 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Wed, 31 May 2023 11:54:10 +0000 (07:54 -0400)
There is no way that xpath can ever be anything but NULL
in the failure path with the goto's.  Let's just remove
the goto's and return immediately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
mgmtd/mgmt_txn.c

index bf59224338355946e21c471c357d6c04058d9dde..3d818cb4c2598ae8f82a3615aa151738d03c4aa8 100644 (file)
@@ -1022,7 +1022,7 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req,
                        (void)mgmt_txn_send_commit_cfg_reply(
                                txn_req->txn, MGMTD_INTERNAL_ERROR,
                                "Internal error! Could not get Xpath from Ds node!");
-                       goto mgmt_txn_create_config_batches_failed;
+                       return -1;
                }
 
                value = (char *)lyd_get_value(chg->cb.dnode);
@@ -1130,18 +1130,11 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req,
                (void)mgmt_txn_send_commit_cfg_reply(
                        txn_req->txn, MGMTD_NO_CFG_CHANGES,
                        "No changes found to commit!");
-               goto mgmt_txn_create_config_batches_failed;
+               return -1;
        }
 
        cmtcfg_req->next_phase = MGMTD_COMMIT_PHASE_TXN_CREATE;
        return 0;
-
-mgmt_txn_create_config_batches_failed:
-
-       if (xpath)
-               free(xpath);
-
-       return -1;
 }
 
 static int mgmt_txn_prepare_config(struct mgmt_txn_ctx *txn)