summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeelan10 <keelan.cannoo@icloud.com>2023-04-03 09:36:33 +0200
committerKeelan10 <keelan.cannoo@icloud.com>2023-04-03 15:51:48 +0200
commit5aa36ff77b83d50cecf2b9c9854fc439c77d464f (patch)
treebf22467077c9878b285dd73cab6cb7b0398602fd
parentMerge pull request #13182 from taspelund/add_bgp_json_comments (diff)
downloadfrr-5aa36ff77b83d50cecf2b9c9854fc439c77d464f.tar.xz
frr-5aa36ff77b83d50cecf2b9c9854fc439c77d464f.zip
sharpd: Fix sharpd memory leak
Free path Signed-off-by: Keelan Cannoo <keelan.cannoo@icloud.com>
-rw-r--r--lib/cspf.c2
-rw-r--r--lib/cspf.h2
-rw-r--r--sharpd/sharp_vty.c3
3 files changed, 5 insertions, 2 deletions
diff --git a/lib/cspf.c b/lib/cspf.c
index b92c9cb39..6a0fb7f63 100644
--- a/lib/cspf.c
+++ b/lib/cspf.c
@@ -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;
diff --git a/lib/cspf.h b/lib/cspf.h
index 3eceaa04a..bba685a61 100644
--- a/lib/cspf.h
+++ b/lib/cspf.h
@@ -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
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c
index 77b562d6a..1fdac2c28 100644
--- a/sharpd/sharp_vty.c
+++ b/sharpd/sharp_vty.c
@@ -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;
}