]> git.puffer.fish Git - mirror/frr.git/commitdiff
sharpd: Fix sharpd memory leak 13194/head
authorKeelan10 <keelan.cannoo@icloud.com>
Mon, 3 Apr 2023 07:36:33 +0000 (11:36 +0400)
committerKeelan10 <keelan.cannoo@icloud.com>
Mon, 3 Apr 2023 13:51:48 +0000 (17:51 +0400)
Free path

Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
lib/cspf.c
lib/cspf.h
sharpd/sharp_vty.c

index b92c9cb395de42e350e721cf50d514a94b887225..6a0fb7f63cc20b3bb0c3dd27bbdd2bea8f44f9ca 100644 (file)
@@ -88,7 +88,7 @@ static struct c_path *cpath_copy(struct c_path *dest, const struct c_path *src)
  *
  * @param path Constrained Path structure to be deleted
  */
-static void cpath_del(struct c_path *path)
+void cpath_del(struct c_path *path)
 {
        if (!path)
                return;
index 3eceaa04af05302a9dffe6f6daa22dd298f0518c..bba685a6172d907b2a328f19246cb65d684b8a81 100644 (file)
@@ -191,6 +191,8 @@ extern void cspf_del(struct cspf *algo);
  */
 extern struct c_path *compute_p2p_path(struct cspf *algo, struct ls_ted *ted);
 
+extern void cpath_del(struct c_path *path);
+
 #ifdef __cplusplus
 }
 #endif
index 77b562d6a61ef69023152b8e865e2ef54ad8737e..1fdac2c286c7f328ac8a97900453f48a855534ff 100644 (file)
@@ -1245,6 +1245,7 @@ DEFPY (show_sharp_cspf,
        }
        if (path->status != SUCCESS) {
                vty_out(vty, "Path computation failed: %d\n", path->status);
+               cpath_del(path);
                return CMD_SUCCESS;
        }
 
@@ -1260,7 +1261,7 @@ DEFPY (show_sharp_cspf,
                                &edge->attributes->standard.remote6);
        }
        vty_out(vty, "\n");
-
+       cpath_del(path);
        return CMD_SUCCESS;
 }