summaryrefslogtreecommitdiffstats
path: root/lib/prefix.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-10-30 01:05:27 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-11-02 21:13:44 +0100
commit63265b5c1f9fb28946376b535a814bec1dbd19ed (patch)
treee244c4ed35ac29185f6d77092f646f19fa704b65 /lib/prefix.c
parentMerge pull request #5263 from donaldsharp/pim_excessive_warnings (diff)
downloadfrr-63265b5c1f9fb28946376b535a814bec1dbd19ed.tar.xz
frr-63265b5c1f9fb28946376b535a814bec1dbd19ed.zip
*: Convert prefix_free to double pointer
Have the prefix_free code take a double pointer to free the data. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/prefix.c')
-rw-r--r--lib/prefix.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/prefix.c b/lib/prefix.c
index 5071ca820..e2bf3b949 100644
--- a/lib/prefix.c
+++ b/lib/prefix.c
@@ -905,9 +905,9 @@ struct prefix_ipv4 *prefix_ipv4_new(void)
}
/* Free prefix_ipv4 structure. */
-void prefix_ipv4_free(struct prefix_ipv4 *p)
+void prefix_ipv4_free(struct prefix_ipv4 **p)
{
- prefix_free((struct prefix *)p);
+ prefix_free((struct prefix **)p);
}
/* If given string is valid return 1 else return 0 */
@@ -1077,9 +1077,9 @@ struct prefix_ipv6 *prefix_ipv6_new(void)
}
/* Free prefix for IPv6. */
-void prefix_ipv6_free(struct prefix_ipv6 *p)
+void prefix_ipv6_free(struct prefix_ipv6 **p)
{
- prefix_free((struct prefix *)p);
+ prefix_free((struct prefix **)p);
}
/* If given string is valid return 1 else return 0 */
@@ -1484,10 +1484,18 @@ struct prefix *prefix_new(void)
return p;
}
+void prefix_free_lists(void *arg)
+{
+ struct prefix *p = arg;
+
+ prefix_free(&p);
+}
+
/* Free prefix structure. */
-void prefix_free(struct prefix *p)
+void prefix_free(struct prefix **p)
{
- XFREE(MTYPE_PREFIX, p);
+ XFREE(MTYPE_PREFIX, *p);
+ *p = NULL;
}
/* Utility function to convert ipv4 prefixes to Classful prefixes */