aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authoryaolujing <yaolujing@huawei.com>2017-04-01 08:15:09 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2017-04-02 21:18:21 +0200
commitcc1e13913916f755fd2dc5041b8d4bf25d3ea88e (patch)
tree8ad9ad6323fdb57923b7a56012b097f296f97d63 /block
parentcb9a05a4f169347f85e345a2abe42c45e1d3157b (diff)
nbd: fix memory leak on socket_connect failed
When TCP connection fails between nbd server and client, the local var, sioc, memory leak. This patch fixes the memory leak. Signed-off-by: yaolujing <yaolujing@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <1491005709-29989-1-git-send-email-yaolujing@huawei.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/nbd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 1b832c2132..3150712f0c 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -311,6 +311,7 @@ static QIOChannelSocket *nbd_establish_connection(SocketAddress *saddr,
saddr,
&local_err);
if (local_err) {
+ object_unref(OBJECT(sioc));
error_propagate(errp, local_err);
return NULL;
}