From: yaolujing <yaolujing@huawei.com>
To: pbonzini@redhat.com, kwolf@redhat.com, mreitz@redhat.com
Cc: sochin.jiang@huawei.com, xieyingtai@huawei.com,
eric.fangyi@huawei.com, subo7@huawei.com, wangjie88@huawei.com,
zhangshuai13@huawei.com, yaolujing@huawei.com,
qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] nbd: fix memory leak on socket_connect failed
Date: Sat, 1 Apr 2017 08:15:09 +0800 [thread overview]
Message-ID: <1491005709-29989-1-git-send-email-yaolujing@huawei.com> (raw)
From: y00357587 <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: y00357587 <yaolujing@huawei.com>
---
block/nbd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/nbd.c b/block/nbd.c
index 35f24be..102285e 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -313,6 +313,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
next reply other threads:[~2017-04-01 2:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-01 0:15 yaolujing [this message]
2017-04-01 14:37 ` [Qemu-devel] [PATCH for-2.9] nbd: fix memory leak on socket_connect failed Eric Blake
2017-04-03 7:06 ` [Qemu-devel] [PATCH] " Paolo Bonzini
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=1491005709-29989-1-git-send-email-yaolujing@huawei.com \
--to=yaolujing@huawei.com \
--cc=eric.fangyi@huawei.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sochin.jiang@huawei.com \
--cc=subo7@huawei.com \
--cc=wangjie88@huawei.com \
--cc=xieyingtai@huawei.com \
--cc=zhangshuai13@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).