Skip to content

Commit 5f88a08

Browse files
committed
fix: friend_connections leak on allocation failure
clean up when it only contains connections in the NONE state
1 parent 6d27a1a commit 5f88a08

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

toxcore/friend_connection.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,11 @@ void kill_friend_connections(Friend_Connections *fr_c)
10321032
kill_friend_connection(fr_c, i);
10331033
}
10341034

1035+
// there might be allocated NONE connections
1036+
if (fr_c->conns != nullptr) {
1037+
free(fr_c->conns);
1038+
}
1039+
10351040
lan_discovery_kill(fr_c->broadcast);
10361041
free(fr_c);
10371042
}

0 commit comments

Comments
 (0)