qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH v2] severe memory leak caused by broken palette_


From: Juan Quintela
Subject: [Qemu-devel] Re: [PATCH v2] severe memory leak caused by broken palette_destroy() function
Date: Fri, 25 Mar 2011 10:28:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Ulrich Obergfell <address@hidden> wrote:
> This is version 2 of the patch that I originally posted in:
>
> http://lists.gnu.org/archive/html/qemu-devel/2011-03/msg02063.html
>
> [Sorry, I missed to include the keyword 'PATCH' in the subject
>  of the original post.]
>
> The following commit breaks the code of the function palette_destroy().
>
> http://git.kernel.org/?p=virt/kvm/qemu-kvm.git;a=commit;h=e31e3694afef58ba191cbcc6875ec243e5971268
>
> The broken code causes a severe memory leak of 'VncPalette' structures
> because it never frees anything:
>
>      70 void palette_destroy(VncPalette *palette)
>      71 {
>      72     if (palette == NULL) {
>      73         qemu_free(palette);
>      74     }
>      75 }
>
> Version 2 of the patch calls qemu_free() unconditionally.
>
> Signed-off-by: Ulrich Obergfell <address@hidden>


Ouchhhhhhhhhhhhhhh

Reviewed-by: Juan Quintela <address@hidden>

A new reason to never ever test if pointer is != NULL before calling
free.

Good catch.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]