Browse Source

Fix supernode memory leak on exit path

pull/992/head
Hamish Coleman 3 years ago
parent
commit
038c244407
  1. 1
      src/edge_utils.c
  2. 3
      src/n2n.c

1
src/edge_utils.c

@ -2994,6 +2994,7 @@ void edge_term (n2n_edge_t * eee) {
clear_peer_list(&eee->pending_peers); clear_peer_list(&eee->pending_peers);
clear_peer_list(&eee->known_peers); clear_peer_list(&eee->known_peers);
clear_peer_list(&eee->conf.supernodes);
eee->transop.deinit(&eee->transop); eee->transop.deinit(&eee->transop);
eee->transop_lzo.deinit(&eee->transop_lzo); eee->transop_lzo.deinit(&eee->transop_lzo);

3
src/n2n.c

@ -653,6 +653,9 @@ size_t clear_peer_list (struct peer_info ** peer_list) {
size_t retval = 0; size_t retval = 0;
HASH_ITER(hh, *peer_list, scan, tmp) { HASH_ITER(hh, *peer_list, scan, tmp) {
if (scan->purgeable == SN_UNPURGEABLE && scan->ip_addr) {
free(scan->ip_addr);
}
HASH_DEL(*peer_list, scan); HASH_DEL(*peer_list, scan);
mgmt_event_post(N2N_EVENT_PEER,N2N_EVENT_PEER_CLEAR,scan); mgmt_event_post(N2N_EVENT_PEER,N2N_EVENT_PEER_CLEAR,scan);
/* FIXME: generates events for more than just p2p */ /* FIXME: generates events for more than just p2p */

Loading…
Cancel
Save