]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commit
net: take ownership of fd in socket init functions
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 7 Dec 2011 15:01:49 +0000 (15:01 +0000)
committerAnthony Liguori <aliguori@us.ibm.com>
Mon, 12 Dec 2011 23:06:21 +0000 (17:06 -0600)
commite5d1fca0f20babbe355957b9ba536fe6187691cc
tree1b824059aa57b10bb5995e276673b9cfa0e6484b
parent842480d493a085fd9598d35b3318765699f88709
net: take ownership of fd in socket init functions

Today net/socket.c has no consistent policy for closing the socket file
descriptor when initialization fails.  This means we leak the file
descriptor in some cases or we could also try to close it twice.

Make error paths consistent by taking ownership of the file descriptor
and closing it on error.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/socket.c