Patchwork [1/2] NBD: Avoid leaking a couple of strings when the NBD device is closed

login
register
mail settings
Submitter Nicholas Thomas
Date April 28, 2011, 3:20 p.m.
Message ID <1304004002-2018-1-git-send-email-nick@bytemark.co.uk>
Download mbox | patch
Permalink /patch/93236/
State New
Headers show

Comments

Nicholas Thomas - April 28, 2011, 3:20 p.m.
From: Nick Thomas <nick@bytemark.co.uk>

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
---
 block/nbd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Stefan Hajnoczi - May 3, 2011, 11:01 a.m.
On Thu, Apr 28, 2011 at 4:20 PM,  <nick@bytemark.co.uk> wrote:
> From: Nick Thomas <nick@bytemark.co.uk>
>
> Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
> ---
>  block/nbd.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

Patch

diff --git a/block/nbd.c b/block/nbd.c
index 1d6b225..7a52f62 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -239,6 +239,10 @@  static int nbd_write(BlockDriverState *bs, int64_t sector_num,
 
 static void nbd_close(BlockDriverState *bs)
 {
+    BDRVNBDState *s = bs->opaque;
+    qemu_free(s->export_name);
+    qemu_free(s->host_spec);
+
     nbd_teardown_connection(bs);
 }