Patchwork [v2,4/4] block: Fix how mirror_run() frees its buffer

login
register
mail settings
Submitter Markus Armbruster
Date Jan. 15, 2013, 2:29 p.m.
Message ID <1358260150-9760-5-git-send-email-armbru@redhat.com>
Download mbox | patch
Permalink /patch/212178/
State New
Headers show

Comments

Markus Armbruster - Jan. 15, 2013, 2:29 p.m.
It allocates with qemu_blockalign(), therefore it must free with
qemu_vfree(), not g_free().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/mirror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/block/mirror.c b/block/mirror.c
index 8aeacbf..6180aa3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -225,7 +225,7 @@  static void coroutine_fn mirror_run(void *opaque)
     }
 
 immediate_exit:
-    g_free(s->buf);
+    qemu_vfree(s->buf);
     bdrv_set_dirty_tracking(bs, false);
     bdrv_iostatus_disable(s->target);
     if (s->should_complete && ret == 0) {