From: Razvan Cojocaru <[email protected]>

run_updown_runner() leaked dns_pipe_fd when pipe(ack_pipe_fd) failed.

Broken since 1dfe8729 ("dns: support running up/down command with
privsep").

Change-Id: I73efe00fddbd919897489c975ec65ed4b4628cc8
Signed-off-by: Razvan Cojocaru <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2091
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2091
This mail reflects revision 2 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>

        
diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c
index e5ed1bc..abe30ed 100644
--- a/src/openvpn/dns.c
+++ b/src/openvpn/dns.c
@@ -608,11 +608,18 @@
 {
     int dns_pipe_fd[2];
     int ack_pipe_fd[2];
-    if (pipe(dns_pipe_fd) != 0 || pipe(ack_pipe_fd) != 0)
+    if (pipe(dns_pipe_fd) != 0)
     {
         msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to create pipes");
         return false;
     }
+    if (pipe(ack_pipe_fd) != 0)
+    {
+        msg(M_WARN | M_ERRNO, "run_dns_up_down: unable to create pipes");
+        close(dns_pipe_fd[0]);
+        close(dns_pipe_fd[1]);
+        return false;
+    }
     updown_runner->pid = fork();
     if (updown_runner->pid == -1)
     {


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to