Skip to content

Commit

Permalink
Add NULL setting after freed pointer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakio815 committed Jan 22, 2025
1 parent 6147df6 commit 70e9e57
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/federated/federate.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ static void close_inbound_netdrv(int fed_id) {
LF_MUTEX_LOCK(&netdrv_mutex);
if (_fed.netdrvs_for_inbound_p2p_connections[fed_id] != NULL) {
shutdown_netdrv(_fed.netdrvs_for_inbound_p2p_connections[fed_id], false);
_fed.netdrvs_for_inbound_p2p_connections[fed_id] = NULL;
}
LF_MUTEX_UNLOCK(&netdrv_mutex);
}
Expand Down Expand Up @@ -825,10 +826,12 @@ static void close_outbound_netdrv(int fed_id) {
// Close the network driver by sending a FIN packet indicating that no further writes
// are expected. Then read until we get an EOF indication.
shutdown_netdrv(_fed.netdrvs_for_outbound_p2p_connections[fed_id], true);
_fed.netdrvs_for_outbound_p2p_connections[fed_id] = NULL;
}
LF_MUTEX_UNLOCK(&lf_outbound_netdrv_mutex);
} else {
shutdown_netdrv(_fed.netdrvs_for_outbound_p2p_connections[fed_id], false);
_fed.netdrvs_for_outbound_p2p_connections[fed_id] = NULL;
}
}

Expand Down

0 comments on commit 70e9e57

Please sign in to comment.