[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 30/32] block-nbd: close sock in nbd_open() error path



From: Yunlei Ding <yunlei.ding@xxxxxxxxxx>

Close sock handle before return.

Signed-off-by: Yunlei Ding <yunlei.ding@xxxxxxxxxx>
Coverity-ID: 1055914
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 block-nbd.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/block-nbd.c b/block-nbd.c
index dc63183..e2c90eb 100644
--- a/block-nbd.c
+++ b/block-nbd.c
@@ -88,7 +88,10 @@ static int nbd_open(BlockDriverState *bs, const char* 
filename, int flags)
 
     ret = nbd_receive_negotiate(sock, &size, &blocksize);
     if (ret == -1)
+    {
+        close(sock);
         return -errno;
+    }
 
     s->sock = sock;
     s->size = size;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.