summaryrefslogtreecommitdiffstats
path: root/ui/vnc-palette.c
diff options
context:
space:
mode:
authorUlrich Obergfell2011-03-25 09:45:54 +0100
committerAnthony Liguori2011-03-25 13:28:24 +0100
commitd6e58090fed20e30e6966007bc4df0c04324d9e7 (patch)
treea208a61449db46fc5fd08214168c1ad5f3588845 /ui/vnc-palette.c
parentvl.c: Fix compilation failure if CONFIG_SDL isn't defined (diff)
downloadqemu-d6e58090fed20e30e6966007bc4df0c04324d9e7.tar.gz
qemu-d6e58090fed20e30e6966007bc4df0c04324d9e7.tar.xz
qemu-d6e58090fed20e30e6966007bc4df0c04324d9e7.zip
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: Ulrich Obergfell <uobergfe@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'ui/vnc-palette.c')
-rw-r--r--ui/vnc-palette.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c
index c478060865..13ece42160 100644
--- a/ui/vnc-palette.c
+++ b/ui/vnc-palette.c
@@ -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)