From 35b16b9cee480c70b002de9797e69b9fa76dba66 Mon Sep 17 00:00:00 2001 From: xor2003 Date: Fri, 17 Oct 2014 11:22:18 +0400 Subject: [PATCH 1/3] forgotten to free memory in pAdapterInfo --- toxcore/LAN_discovery.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index 3c05fe8d..ba372589 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c @@ -86,6 +86,10 @@ static void fetch_broadcast_info(uint16_t port) pAdapter = pAdapter->Next; } } + + if (pAdapterInfo) { + free(pAdapterInfo); + } } #elif defined(__linux__) From 1b60fbed562b88244b7a3133cf830beacfcc6632 Mon Sep 17 00:00:00 2001 From: xor2003 Date: Fri, 17 Oct 2014 11:26:22 +0400 Subject: [PATCH 2/3] Trying to fix TimerHandler *handler memory leak --- toxav/msi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/toxav/msi.c b/toxav/msi.c index 5efaf147..7f390435 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -699,6 +699,8 @@ static void timer_terminate_session(TimerHandler *handler) free(handler->timers); pthread_mutex_destroy( &handler->mutex ); + + free(handler); } /** From 0ce68b994e4c7f46fe08b5cd1b8493c97eb5654f Mon Sep 17 00:00:00 2001 From: xor2003 Date: Fri, 17 Oct 2014 16:15:22 +0400 Subject: [PATCH 3/3] Initialise source.port to prevent garbage value --- toxcore/TCP_server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index 5dae1262..c7bccab7 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c @@ -805,6 +805,7 @@ static int handle_TCP_packet(TCP_Server *TCP_server, uint32_t con_id, const uint return -1; IP_Port source; + source.port = 0; // dummy initialise source.ip.family = TCP_ONION_FAMILY; source.ip.ip6.uint32[0] = con_id; source.ip.ip6.uint64[1] = con->identifier;