Skip to content

Commit

Permalink
fix: friend_connections leak on allocation failure
Browse files Browse the repository at this point in the history
clean up when it only contains connections in the NONE state
  • Loading branch information
Green-Sky committed Nov 8, 2024
1 parent 6d27a1a commit 5f88a08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions toxcore/friend_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,11 @@ void kill_friend_connections(Friend_Connections *fr_c)
kill_friend_connection(fr_c, i);
}

// there might be allocated NONE connections
if (fr_c->conns != nullptr) {
free(fr_c->conns);
}

lan_discovery_kill(fr_c->broadcast);
free(fr_c);
}

0 comments on commit 5f88a08

Please sign in to comment.