extcap: Close stdout_fd and stderr_fd when done
authorStig Bjørlykke <stig@bjorlykke.org>
Mon, 15 Oct 2018 18:41:39 +0000 (20:41 +0200)
committerStig Bjørlykke <stig@bjorlykke.org>
Wed, 17 Oct 2018 17:46:22 +0000 (17:46 +0000)
The documentation for g_spawn_async_with_pipes() states that stdout_fd
and stderr_fd must be closed when they are no longer in use.

Ping-Bug: 15205
Change-Id: I943eaa68058b0828686469672ea3611e67390b2f
Reviewed-on: https://code.wireshark.org/review/30221
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
extcap.c

index bcbc9a8c9a59ef82e67d91711426b4a3a9222955..7c65267fc9aa85bdb9bcfc6f6d4bba4e84f80ebe 100644 (file)
--- a/extcap.c
+++ b/extcap.c
@@ -1187,6 +1187,16 @@ void extcap_if_cleanup(capture_options *capture_opts, gchar **errormsg)
             interface_opts->extcap_child_watch = 0;
         }
 
+        if (pipedata->stdout_fd > 0)
+        {
+            ws_close(pipedata->stdout_fd);
+        }
+
+        if (pipedata->stderr_fd > 0)
+        {
+            ws_close(pipedata->stderr_fd);
+        }
+
         if (interface_opts->extcap_pid != WS_INVALID_PID)
         {
 #ifdef _WIN32