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

Submitted by Nicholas Thomas on April 28, 2011, 3:20 p.m.

Details

Message ID 1304004002-2018-1-git-send-email-nick@bytemark.co.uk
State New
Headers show

Commit Message

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(-)

Comments

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 hide | download patch | download mbox

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);
 }