From: Guy Harris Date: Fri, 10 Nov 2017 21:13:10 +0000 (-0800) Subject: Don't leak thread handles. X-Git-Tag: libpcap-1.9-bp~390 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/a4acd198ebe19f4969c0d4e88c636bd687a4caaf?ds=inline Don't leak thread handles. These threads just run in the background; we don't need to wait for them to finish, so close the handle as soon as we've gotten it. --- diff --git a/rpcapd/rpcapd.c b/rpcapd/rpcapd.c index 8a4924ec..0f0f5805 100755 --- a/rpcapd/rpcapd.c +++ b/rpcapd/rpcapd.c @@ -336,6 +336,7 @@ void main_startup(void) SOCK_ASSERT("Error creating the active child threads", 1); continue; } + CloseHandle(threadId); #else if ((pid = fork()) == 0) // I am the child { @@ -399,6 +400,7 @@ void main_startup(void) SOCK_ASSERT("Error creating the passive child thread", 1); continue; } + CloseHandle(threadId); #else if ((pid = fork()) == 0) // I am the child { @@ -597,6 +599,7 @@ main_passive(void *ptr) sock_close(sockctrl, NULL, 0); continue; } + CloseHandle(threadId); #else if ((pid = fork()) == 0) // I am the child {