]> git.proxmox.com Git - mirror_qemu.git/commitdiff
nbd: fix memory leak on socket_connect failed
authoryaolujing <yaolujing@huawei.com>
Sat, 1 Apr 2017 00:15:09 +0000 (08:15 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sun, 2 Apr 2017 19:18:21 +0000 (21:18 +0200)
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>
block/nbd.c

index 1b832c2132b681d68c03ba530adfca3b50d99814..3150712f0c9e9b0cf80300cf32cd8ce9a341e3d2 100644 (file)
@@ -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;
     }