diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-22 21:39:18 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-24 14:04:20 +0200 |
commit | 92035b1db4a91d0fc95118a1e0ff73cfa6120b1b (patch) | |
tree | 8111c5128c76f620740a7ae7cf13e272fe791db0 /eigrpd/eigrp_update.c | |
parent | eigrpd: Cleanup list accessors (diff) | |
download | frr-92035b1db4a91d0fc95118a1e0ff73cfa6120b1b.tar.xz frr-92035b1db4a91d0fc95118a1e0ff73cfa6120b1b.zip |
eigrpd: Fix memory leak in FSM
The FSM was never freeing the msg. Since we
do not have a special queue for it, just don't
allocate the memory. In the future we can put
this back.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd/eigrp_update.c')
-rw-r--r-- | eigrpd/eigrp_update.c | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c index 2934c6c65..a3d6210e7 100644 --- a/eigrpd/eigrp_update.c +++ b/eigrpd/eigrp_update.c @@ -132,24 +132,22 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp, /* prepare message for FSM */ - struct eigrp_fsm_action_message *fsm_msg; - fsm_msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, - sizeof(struct eigrp_fsm_action_message)); + struct eigrp_fsm_action_message fsm_msg; struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(prefix->entries, nbr); - fsm_msg->packet_type = EIGRP_OPC_UPDATE; - fsm_msg->eigrp = eigrp; - fsm_msg->data_type = EIGRP_TLV_IPv4_INT; - fsm_msg->adv_router = nbr; - fsm_msg->data.ipv4_int_type = tlv_max; - fsm_msg->entry = entry; - fsm_msg->prefix = prefix; + fsm_msg.packet_type = EIGRP_OPC_UPDATE; + fsm_msg.eigrp = eigrp; + fsm_msg.data_type = EIGRP_TLV_IPv4_INT; + fsm_msg.adv_router = nbr; + fsm_msg.data.ipv4_int_type = tlv_max; + fsm_msg.entry = entry; + fsm_msg.prefix = prefix; /* send message to FSM */ - int event = eigrp_get_fsm_event(fsm_msg); - eigrp_fsm_event(fsm_msg, event); + int event = eigrp_get_fsm_event(&fsm_msg); + eigrp_fsm_event(&fsm_msg, event); /* free memory used by TLV */ eigrp_IPv4_InternalTLV_free(tlv_max); @@ -311,23 +309,20 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph, remove_received_prefix_gr(nbr_prefixes, dest); - struct eigrp_fsm_action_message *msg; - msg = XCALLOC(MTYPE_EIGRP_FSM_MSG, - sizeof(struct - eigrp_fsm_action_message)); + struct eigrp_fsm_action_message msg; struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(dest->entries, nbr); - msg->packet_type = EIGRP_OPC_UPDATE; - msg->eigrp = eigrp; - msg->data_type = EIGRP_TLV_IPv4_INT; - msg->adv_router = nbr; - msg->data.ipv4_int_type = tlv; - msg->entry = entry; - msg->prefix = dest; - int event = eigrp_get_fsm_event(msg); - eigrp_fsm_event(msg, event); + msg.packet_type = EIGRP_OPC_UPDATE; + msg.eigrp = eigrp; + msg.data_type = EIGRP_TLV_IPv4_INT; + msg.adv_router = nbr; + msg.data.ipv4_int_type = tlv; + msg.entry = entry; + msg.prefix = dest; + int event = eigrp_get_fsm_event(&msg); + eigrp_fsm_event(&msg, event); } else { /*Here comes topology information save*/ pe = eigrp_prefix_entry_new(); @@ -978,25 +973,22 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr) pe->destination_ipv4->prefixlen; /* prepare message for FSM */ - struct eigrp_fsm_action_message *fsm_msg; - fsm_msg = XCALLOC( - MTYPE_EIGRP_FSM_MSG, - sizeof(struct eigrp_fsm_action_message)); + struct eigrp_fsm_action_message fsm_msg; struct eigrp_neighbor_entry *entry = eigrp_prefix_entry_lookup(pe->entries, nbr); - fsm_msg->packet_type = EIGRP_OPC_UPDATE; - fsm_msg->eigrp = e; - fsm_msg->data_type = EIGRP_TLV_IPv4_INT; - fsm_msg->adv_router = nbr; - fsm_msg->data.ipv4_int_type = tlv_max; - fsm_msg->entry = entry; - fsm_msg->prefix = pe; + fsm_msg.packet_type = EIGRP_OPC_UPDATE; + fsm_msg.eigrp = e; + fsm_msg.data_type = EIGRP_TLV_IPv4_INT; + fsm_msg.adv_router = nbr; + fsm_msg.data.ipv4_int_type = tlv_max; + fsm_msg.entry = entry; + fsm_msg.prefix = pe; /* send message to FSM */ - int event = eigrp_get_fsm_event(fsm_msg); - eigrp_fsm_event(fsm_msg, event); + int event = eigrp_get_fsm_event(&fsm_msg); + eigrp_fsm_event(&fsm_msg, event); /* free memory used by TLV */ eigrp_IPv4_InternalTLV_free(tlv_max); |