[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/9] arm: fix memory leak
From: |
Gonglei |
Subject: |
Re: [Qemu-devel] [Qemu-trivial] [PATCH 2/9] arm: fix memory leak |
Date: |
Thu, 5 Mar 2015 10:26:17 +0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
On 2015/3/4 21:16, Michael Tokarev wrote:
> 27.02.2015 10:50, address@hidden wrote:
> []
>> @@ -565,6 +565,7 @@ static void create_flash(const VirtBoardInfo *vbi)
>> error_report("Could not load ROM image '%s'", bios_name);
>> exit(1);
>> }
>> + g_free(fn);
>> }
>>
>> create_one_flash("virt.flash0", flashbase, flashsize);
>>
>
> This change introduces a compiler error:
>
> hw/arm/virt.c: In function ‘create_flash’:
> hw/arm/virt.c:568:16: error: passing argument 1 of ‘g_free’ discards ‘const’
> qualifier from pointer target type [-Werror]
> g_free(fn);
> ^
> /usr/include/glib-2.0/glib/gmem.h:69:7: note: expected ‘gpointer’ but
> argument is of type ‘const char *’
> void g_free (gpointer mem);
> ^
>
> This is because just a few lines above, `fn' variable
> is declared as `const char *', which obviously should
> not be used with any *free() functions.
>
Yes, and I found another similar problem in
[PATCH 9/9] microblaze: fix memory leak
which you had pulled, maybe make sense wait a minuter.
Sorry for this.
> The solution is to remove `const' from the variable
> declaration.
>
Correct.
> And a much more general solution is to actually test
> patches before submitting them. You obviously did not
> test this series, having 3 errors in 9 patches, ie,
> 1/3 of your patches does not work...
>
Apologize earnestly for troubling you. :(
I just thought they are so trivial, meanwhile I hadn't arm compiling
environment (lack of
libfdt-dev), and assigned "--target-list=x86_64-softmmu" that moment.
Regards,
-Gonglei