summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_packet.c
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2015-10-21 00:13:20 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2015-10-21 00:13:20 +0200
commit9e08021c3557814d1d556fb659e15311a687157c (patch)
treef05fe1133b6384dc5f579f42643fe423f55d0ad0 /bgpd/bgp_packet.c
parentBGP: crash in list_delete_all_node when shutting down BGP (diff)
downloadfrr-9e08021c3557814d1d556fb659e15311a687157c.tar.xz
frr-9e08021c3557814d1d556fb659e15311a687157c.zip
BGP: crash from not NULLing freed pointers
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Ticket: CM-7926 There was a crash from not NULLing out peer->hostname but I cleaned up a bunch of other suspect ones as well.
Diffstat (limited to 'bgpd/bgp_packet.c')
-rw-r--r--bgpd/bgp_packet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 6aec5e633..d378be639 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -642,8 +642,13 @@ bgp_notify_send_with_data (struct peer *peer, u_char code, u_char sub_code,
}
}
bgp_notify_print (peer, &bgp_notify, "sending");
+
if (bgp_notify.data)
- XFREE (MTYPE_TMP, bgp_notify.data);
+ {
+ XFREE (MTYPE_TMP, bgp_notify.data);
+ bgp_notify.data = NULL;
+ bgp_notify.length = 0;
+ }
}
/* peer reset cause */
@@ -1734,7 +1739,11 @@ bgp_notify_receive (struct peer *peer, bgp_size_t size)
bgp_notify_print(peer, &bgp_notify, "received");
if (bgp_notify.data)
- XFREE (MTYPE_TMP, bgp_notify.data);
+ {
+ XFREE (MTYPE_TMP, bgp_notify.data);
+ bgp_notify.data = NULL;
+ bgp_notify.length = 0;
+ }
}
/* peer count update */