From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Hbd-0006LV-EK for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U1Hba-0000eG-BV for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U1Hba-0000e7-4k for qemu-devel@nongnu.org; Fri, 01 Feb 2013 09:28:38 -0500 From: Stefan Hajnoczi Date: Fri, 1 Feb 2013 15:28:01 +0100 Message-Id: <1359728884-19422-11-git-send-email-stefanha@redhat.com> In-Reply-To: <1359728884-19422-1-git-send-email-stefanha@redhat.com> References: <1359728884-19422-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH 10/13] dmg: Use g_free instead of free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi From: Kevin Wolf The buffers are allocated with g_(re)alloc, so use g_free to free them. Signed-off-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi --- block/dmg.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/block/dmg.c b/block/dmg.c index 53be25d..6d85801 100644 --- a/block/dmg.c +++ b/block/dmg.c @@ -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); } -- 1.8.1