]> git.proxmox.com Git - qemu.git/commitdiff
dmg: Use g_free instead of free
authorKevin Wolf <kwolf@redhat.com>
Fri, 25 Jan 2013 16:07:31 +0000 (17:07 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 1 Feb 2013 13:58:29 +0000 (14:58 +0100)
The buffers are allocated with g_(re)alloc, so use g_free to free them.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/dmg.c

index 53be25d7874291c4215e4a2e616a44a19e8fd02c..6d85801a84750bd9360c3eb8582a659eb542020d 100644 (file)
@@ -355,15 +355,15 @@ static coroutine_fn int dmg_co_read(BlockDriverState *bs, int64_t sector_num,
 static void dmg_close(BlockDriverState *bs)
 {
     BDRVDMGState *s = bs->opaque;
-    if(s->n_chunks>0) {
-       free(s->types);
-       free(s->offsets);
-       free(s->lengths);
-       free(s->sectors);
-       free(s->sectorcounts);
-    }
-    free(s->compressed_chunk);
-    free(s->uncompressed_chunk);
+
+    g_free(s->types);
+    g_free(s->offsets);
+    g_free(s->lengths);
+    g_free(s->sectors);
+    g_free(s->sectorcounts);
+    g_free(s->compressed_chunk);
+    g_free(s->uncompressed_chunk);
+
     inflateEnd(&s->zstream);
 }