summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-28 18:17:44 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-07-28 18:17:44 +0100
commita588c4985eff363154d65aee8607d0a4601655f7 (patch)
tree7dd7a5f22295c64bd63b0f968c99a6621c10da53
parent3aabfec2c83da500ae52fc87ff3a0a60718022db (diff)
parent158b9aa568eabe614d37882dddc2eea534edc7ae (diff)
downloadfocaccia-qemu-a588c4985eff363154d65aee8607d0a4601655f7.tar.gz
focaccia-qemu-a588c4985eff363154d65aee8607d0a4601655f7.zip
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2017-07-28' into staging
nbd patches for 2017-07-28

- Philippe Mathieu-Daudé - nbd: fix memory leak in nbd_opt_go()

# gpg: Signature made Fri 28 Jul 2017 17:59:39 BST
# gpg:                using RSA key 0xA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <eblake@redhat.com>"
# gpg:                 aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>"
# gpg:                 aka "[jpeg image of size 6874]"
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-nbd-2017-07-28:
  nbd: fix memory leak in nbd_opt_go()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--nbd/client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/nbd/client.c b/nbd/client.c
index 509ed5e4ba..0a17de80b5 100644
--- a/nbd/client.c
+++ b/nbd/client.c
@@ -376,9 +376,11 @@ static int nbd_opt_go(QIOChannel *ioc, const char *wantname,
     if (info->request_sizes) {
         stw_be_p(buf + 4 + len + 2, NBD_INFO_BLOCK_SIZE);
     }
-    if (nbd_send_option_request(ioc, NBD_OPT_GO,
-                                4 + len + 2 + 2 * info->request_sizes, buf,
-                                errp) < 0) {
+    error = nbd_send_option_request(ioc, NBD_OPT_GO,
+                                    4 + len + 2 + 2 * info->request_sizes,
+                                    buf, errp);
+    g_free(buf);
+    if (error < 0) {
         return -1;
     }