From patchwork Thu Jan 24 11:02:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5/6] dmg: Use g_free instead of free Date: Thu, 24 Jan 2013 01:02:37 -0000 From: Kevin Wolf X-Patchwork-Id: 215312 Message-Id: <1359025358-5725-6-git-send-email-kwolf@redhat.com> To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com The buffers are allocated with g_(re)alloc, so use g_free to free them. Signed-off-by: Kevin Wolf --- block/dmg.c | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/block/dmg.c b/block/dmg.c index d47d2d8..316d3c0 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -366,15 +366,17 @@ 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); + g_free(s->types); + g_free(s->offsets); + g_free(s->lengths); + g_free(s->sectors); + g_free(s->sectorcounts); } - free(s->compressed_chunk); - free(s->uncompressed_chunk); + g_free(s->compressed_chunk); + g_free(s->uncompressed_chunk); + inflateEnd(&s->zstream); }