From cc1e13913916f755fd2dc5041b8d4bf25d3ea88e Mon Sep 17 00:00:00 2001 From: yaolujing Date: Sat, 1 Apr 2017 08:15:09 +0800 Subject: [PATCH] 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 Reviewed-by: Eric Blake Message-Id: <1491005709-29989-1-git-send-email-yaolujing@huawei.com> Signed-off-by: Paolo Bonzini --- block/nbd.c | 1 + 1 file changed, 1 insertion(+) 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; }