Patchwork [2/2] block:use g_free instead of free in cloop.c

login
register
mail settings
Submitter Robert Wang
Date Nov. 2, 2011, 8:36 a.m.
Message ID <1320222981-3839-2-git-send-email-wdongxu@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/123238/
State New
Headers show

Comments

Robert Wang - Nov. 2, 2011, 8:36 a.m.
From: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>

Fix mismatching allocation and deallocation: g_free should be used to pair with 
g_malloc.

v3: Split to 2 patches: one for fixing coding style, one for replacing free with
    g_free. And correct other 2 places with coding style problem.
v2: Fix spelling: gfree->g_free.
v1: Use gfree, to pair with g_malloc. Also fix coding style.

Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed_by: Ray Wang <raywang@linux.vnet.ibm.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
---
 block/cloop.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Patch

diff --git a/block/cloop.c b/block/cloop.c
index 799b6c2..7570eb8 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -171,10 +171,10 @@  static void cloop_close(BlockDriverState *bs)
 {
     BDRVCloopState *s = bs->opaque;
     if (s->n_blocks > 0) {
-        free(s->offsets);
+        g_free(s->offsets);
     }
-    free(s->compressed_block);
-    free(s->uncompressed_block);
+    g_free(s->compressed_block);
+    g_free(s->uncompressed_block);
     inflateEnd(&s->zstream);
 }