----- Original Message -----
> From: "Paolo Bonzini" <pbonz...@redhat.com>
> To: "Federico Simoncelli" <fsimo...@redhat.com>
> Cc: qemu-devel@nongnu.org, kw...@redhat.com, mtosa...@redhat.com
> Sent: Thursday, February 23, 2012 8:18:28 AM
> Subject: Re: [PATCH 2/3] Update the blkmirror block driver
> 
> 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.

Thanks!

> Also, please squash this patch in part 1.

Yes, I sent it as a separate patch to make it easier to review my
changes (if someone already reviewed Marcelo's patch).
Any comment on the BDRV_O_NO_BACKING flag I added? That's the real
trick I'm pulling here. It basically allows to open the second image
only for writing and it doesn't complain if the backing file is not
there yet (it will be copied during step 4).

-- 
Federico

Reply via email to