All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: yaolujing <yaolujing@huawei.com>
Subject: [Qemu-devel] [PULL 4/6] nbd: fix memory leak on socket_connect failed
Date: Mon,  3 Apr 2017 21:44:07 +0200	[thread overview]
Message-ID: <20170403194409.21276-5-pbonzini@redhat.com> (raw)
In-Reply-To: <20170403194409.21276-1-pbonzini@redhat.com>

From: yaolujing <yaolujing@huawei.com>

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/nbd.c b/block/nbd.c
index 1b832c2..3150712 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;
     }
-- 
1.8.3.1

  parent reply	other threads:[~2017-04-03 19:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03 19:44 [Qemu-devel] [PULL 0/6] Misc patches for QEMU 2.9.0-rc3 Paolo Bonzini
2017-04-03 19:44 ` [Qemu-devel] [PULL 1/6] iscsi: drop unused IscsiAIOCB.qiov field Paolo Bonzini
2017-04-03 19:44 ` [Qemu-devel] [PULL 2/6] target-i386: fix "info lapic" segfault on isapc Paolo Bonzini
2017-04-03 19:44 ` [Qemu-devel] [PULL 3/6] ipmi: Fix macro issues Paolo Bonzini
2017-04-03 19:44 ` Paolo Bonzini [this message]
2017-04-03 19:44 ` [Qemu-devel] [PULL 5/6] exec: revert MemoryRegionCache Paolo Bonzini
2017-04-03 19:44 ` [Qemu-devel] [PULL 6/6] main-loop: Acquire main_context lock around os_host_main_loop_wait Paolo Bonzini
2017-04-04 11:41 ` [Qemu-devel] [PULL 0/6] Misc patches for QEMU 2.9.0-rc3 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170403194409.21276-5-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yaolujing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.