aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2019-04-10 18:19:18 +0200
committerGuy Harris <guy@alum.mit.edu>2019-04-10 19:51:40 +0000
commitb95933a031cbf7b76aa6cf8d3531473eb204d333 (patch)
tree0ecf9c67e55e3333f33c047529aa4baa7ba0ef03
parent3e6af782d52dceb84f6119e424b3c5273c90c426 (diff)
wsutil: Fix pipe handle leaks on Windows
If the PATHEXT environment variable contains .py and extcap is enabled, then Wireshark did leak 2 pipes for every .py file present in the extcap directory (regardless if there was .bat wrapper for it or not). Bug: 15689 Change-Id: Iae402c0075ee8155a7205a59711bbae734da7e9e Reviewed-on: https://code.wireshark.org/review/32812 Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--wsutil/ws_pipe.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/wsutil/ws_pipe.c b/wsutil/ws_pipe.c
index 6f19439ab0..f026408739 100644
--- a/wsutil/ws_pipe.c
+++ b/wsutil/ws_pipe.c
@@ -283,7 +283,14 @@ gboolean ws_pipe_spawn_sync(const gchar *working_directory, const gchar *command
CloseHandle(processInfo.hThread);
}
else
+ {
status = FALSE;
+
+ CloseHandle(child_stdout_rd);
+ CloseHandle(child_stdout_wr);
+ CloseHandle(child_stderr_rd);
+ CloseHandle(child_stderr_wr);
+ }
#else
GSpawnFlags flags = (GSpawnFlags)0;
@@ -358,12 +365,16 @@ GPid ws_pipe_spawn_async(ws_pipe_t *ws_pipe, GPtrArray *args)
if (!CreatePipe(&child_stdout_rd, &child_stdout_wr, &sa, 0))
{
+ CloseHandle(child_stdin_rd);
+ CloseHandle(child_stdin_wr);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Could not create stdout handle");
return FALSE;
}
if (!CreatePipe(&child_stderr_rd, &child_stderr_wr, &sa, 0))
{
+ CloseHandle(child_stdin_rd);
+ CloseHandle(child_stdin_wr);
CloseHandle(child_stdout_rd);
CloseHandle(child_stdout_wr);
g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Could not create stderr handle");