From: yaolujing Date: Sat, 1 Apr 2017 00:15:09 +0000 (+0800) Subject: nbd: fix memory leak on socket_connect failed X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=cc1e13913916f755fd2dc5041b8d4bf25d3ea88e;p=qemu.git 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 --- 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; }