This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Cygwin: sockets: Add missing cleanup if socket/socketpair creation fails


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b995936ab5ab43a28da5f82fae6abb70a0746492

commit b995936ab5ab43a28da5f82fae6abb70a0746492
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Mon Feb 26 18:02:36 2018 +0100

    Cygwin: sockets: Add missing cleanup if socket/socketpair creation fails
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/net.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 4fcc577..25f94d6 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -548,7 +548,10 @@ cygwin_socket (int af, int type, int protocol)
 	  res = fd;
 	}
       else
-        fd.release ();
+	{
+	  delete fh;
+	  fd.release ();
+	}
     }
 
 done:
@@ -2346,6 +2349,8 @@ socketpair (int af, int type, int protocol, int *sb)
 	}
       else
 	{
+	  delete fh_in;
+	  delete fh_out;
 	  fd_in.release ();
 	  fd_out.release ();
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]