From 5f88a084e8c67ea8d8aa733cbb57aabb5082e6d3 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 33bfa40d34..f017b08888 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); }