From 7c28b12cd26f27ce53e95d036eb4c6b8c1101c8b Mon Sep 17 00:00:00 2001 From: Green Sky Date: Thu, 10 Oct 2024 17:10:42 +0200 Subject: [PATCH] fix: friend_connections leak on allocation failure clean up when it only contains connections in the NONE state --- toxcore/friend_connection.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c index 33bfa40d346..f017b088887 100644 --- a/toxcore/friend_connection.c +++ b/toxcore/friend_connection.c @@ -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); }