mka: Fix memory leak in ieee802_1x_kay_create_live_peer() error path

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
This commit is contained in:
Sabrina Dubroca 2016-07-19 11:56:52 +02:00 committed by Jouni Malinen
parent 099613e415
commit 71dc78904f

View file

@ -532,14 +532,16 @@ ieee802_1x_kay_create_live_peer(struct ieee802_1x_mka_participant *participant,
peer->sak_used = FALSE; peer->sak_used = FALSE;
os_memcpy(&peer->sci, &participant->current_peer_sci, os_memcpy(&peer->sci, &participant->current_peer_sci,
sizeof(peer->sci)); sizeof(peer->sci));
dl_list_add(&participant->live_peers, &peer->list);
secy_get_available_receive_sc(participant->kay, &sc_ch); secy_get_available_receive_sc(participant->kay, &sc_ch);
rxsc = ieee802_1x_kay_init_receive_sc(&peer->sci, sc_ch); rxsc = ieee802_1x_kay_init_receive_sc(&peer->sci, sc_ch);
if (!rxsc) if (!rxsc) {
os_free(peer);
return NULL; return NULL;
}
dl_list_add(&participant->live_peers, &peer->list);
dl_list_add(&participant->rxsc_list, &rxsc->list); dl_list_add(&participant->rxsc_list, &rxsc->list);
secy_create_receive_sc(participant->kay, rxsc); secy_create_receive_sc(participant->kay, rxsc);