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