From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0Swm-0002Qg-Q9 for qemu-devel@nongnu.org; Thu, 23 Feb 2012 02:18:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S0Swh-0000HB-78 for qemu-devel@nongnu.org; Thu, 23 Feb 2012 02:18:36 -0500 Received: from mail-ey0-f173.google.com ([209.85.215.173]:51308) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S0Swh-0000H3-1U for qemu-devel@nongnu.org; Thu, 23 Feb 2012 02:18:31 -0500 Received: by eaac1 with SMTP id c1so373818eaa.4 for ; Wed, 22 Feb 2012 23:18:30 -0800 (PST) Sender: Paolo Bonzini Message-ID: <4F45E844.2040703@redhat.com> Date: Thu, 23 Feb 2012 08:18:28 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1329930815-7995-1-git-send-email-fsimonce@redhat.com> <1329930815-7995-3-git-send-email-fsimonce@redhat.com> In-Reply-To: <1329930815-7995-3-git-send-email-fsimonce@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/3] Update the blkmirror block driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Federico Simoncelli Cc: kwolf@redhat.com, mtosatti@redhat.com, qemu-devel@nongnu.org On 02/22/2012 06:13 PM, Federico Simoncelli wrote: > @@ -46,7 +46,7 @@ static int blkmirror_open(BlockDriverState *bs, const char *filename, int flags) > filename += strlen("blkmirror:"); > > /* Parse the raw image filename */ > - filename2 = qemu_malloc(strlen(filename)+1); > + filename2 = qemu_vmalloc(strlen(filename)+1); > escape = 0; > for (i = n = 0; i < strlen(filename); i++) { > if (!escape && filename[i] == ':') { > @@ -66,11 +66,11 @@ static int blkmirror_open(BlockDriverState *bs, const char *filename, int flags) > > m->bs[0] = bdrv_new(""); > if (m->bs[0] == NULL) { > - free(filename2); > + qemu_vfree(filename2); > return -ENOMEM; > } > ret = bdrv_open(m->bs[0], filename2, flags, NULL); > - free(filename2); > + qemu_vfree(filename2); > if (ret < 0) { > return ret; > } These should be g_malloc and g_free. Also, please squash this patch in part 1. Paolo