Commit d6e58090 authored by Ulrich Obergfell's avatar Ulrich Obergfell Committed by Anthony Liguori
Browse files

severe memory leak caused by broken palette_destroy() function

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: default avatarUlrich Obergfell <uobergfe@redhat.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 05175535
......@@ -69,9 +69,7 @@ void palette_init(VncPalette *palette, size_t max, int bpp)
void palette_destroy(VncPalette *palette)
{
if (palette == NULL) {
qemu_free(palette);
}
qemu_free(palette);
}
int palette_put(VncPalette *palette, uint32_t color)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment