summaryrefslogtreecommitdiff
path: root/pimd/pim_tlv.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-10-05 10:51:01 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-10-05 10:53:13 -0400
commitaffe9e99831408960b8b6f8477506ed2874a05dd (patch)
treea6f2f7a898fad5fcdc3f74b233095b6e8f6a2b46 /pimd/pim_tlv.c
parentad183f047cab21576a42a9da0c4ed94cd1391005 (diff)
*: Convert list_delete(struct list *) to ** to allow nulling
Convert the list_delete(struct list *) function to use struct list **. This is to allow the list pointer to be nulled. I keep running into uses of this list_delete function where we forget to set the returned pointer to NULL and attempt to use it and then experience a crash, usually after the developer has long since left the building. Let's make the api explicit in it setting the list pointer to null. Cynical Prediction: This code will expose a attempt to use the NULL'ed list pointer in some obscure bit of code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_tlv.c')
-rw-r--r--pimd/pim_tlv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pimd/pim_tlv.c b/pimd/pim_tlv.c
index 6d7adf2422..3c9ef28f5a 100644
--- a/pimd/pim_tlv.c
+++ b/pimd/pim_tlv.c
@@ -654,12 +654,12 @@ int pim_parse_addr_source(struct prefix_sg *sg, uint8_t *flags,
return addr - buf;
}
-#define FREE_ADDR_LIST(hello_option_addr_list) \
- { \
- if (hello_option_addr_list) { \
- list_delete(hello_option_addr_list); \
- hello_option_addr_list = 0; \
- } \
+#define FREE_ADDR_LIST(hello_option_addr_list) \
+ { \
+ if (hello_option_addr_list) { \
+ list_delete_and_null(&hello_option_addr_list); \
+ hello_option_addr_list = 0; \
+ } \
}
int pim_tlv_parse_addr_list(const char *ifname, struct in_addr src_addr,