All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type()
@ 2014-09-02  6:33 Chen Fan
  2014-09-04  1:10 ` chen.fan.fnst
  2014-09-05 10:11 ` Gerd Hoffmann
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Fan @ 2014-09-02  6:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

 this memory leak is introduced by the original
 commit 3158a3482b0093e41f2b2596fba50774ea31ae08

 valgrind out showing:
 ==14553== 21,459 (72 direct, 21,387 indirect) bytes in 1 blocks are definitely
 lost in loss record 8,055 of 8,082
 ==14553==    at 0x4A06BC3: calloc (vg_replace_malloc.c:618)
 ==14553==    by 0x80DBFBC: XkbGetKeyboardByName (in /usr/lib64/libX11.so.6.3.0)
 ==14553==    by 0x40C704: gtk_display_init (gtk.c:1798)
 ==14553==    by 0x1AEDC1: main (vl.c:4480)

Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
---
 ui/gtk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2345d7e..cdd2567 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1810,6 +1810,13 @@ static void gd_set_keycode_type(GtkDisplayState *s)
             fprintf(stderr, "unknown keycodes `%s', please report to "
                     "qemu-devel@nongnu.org\n", keycodes);
         }
+
+        if (desc) {
+            XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, True);
+        }
+        if (keycodes) {
+            XFree(keycodes);
+        }
     }
 #endif
 }
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type()
  2014-09-02  6:33 [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type() Chen Fan
@ 2014-09-04  1:10 ` chen.fan.fnst
  2014-09-05 10:11 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: chen.fan.fnst @ 2014-09-04  1:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

ping...

On Tue, 2014-09-02 at 14:33 +0800, Chen Fan wrote: 
>  this memory leak is introduced by the original
>  commit 3158a3482b0093e41f2b2596fba50774ea31ae08
> 
>  valgrind out showing:
>  ==14553== 21,459 (72 direct, 21,387 indirect) bytes in 1 blocks are definitely
>  lost in loss record 8,055 of 8,082
>  ==14553==    at 0x4A06BC3: calloc (vg_replace_malloc.c:618)
>  ==14553==    by 0x80DBFBC: XkbGetKeyboardByName (in /usr/lib64/libX11.so.6.3.0)
>  ==14553==    by 0x40C704: gtk_display_init (gtk.c:1798)
>  ==14553==    by 0x1AEDC1: main (vl.c:4480)
> 
> Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
> ---
>  ui/gtk.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/ui/gtk.c b/ui/gtk.c
> index 2345d7e..cdd2567 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -1810,6 +1810,13 @@ static void gd_set_keycode_type(GtkDisplayState *s)
>              fprintf(stderr, "unknown keycodes `%s', please report to "
>                      "qemu-devel@nongnu.org\n", keycodes);
>          }
> +
> +        if (desc) {
> +            XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, True);
> +        }
> +        if (keycodes) {
> +            XFree(keycodes);
> +        }
>      }
>  #endif
>  }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type()
  2014-09-02  6:33 [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type() Chen Fan
  2014-09-04  1:10 ` chen.fan.fnst
@ 2014-09-05 10:11 ` Gerd Hoffmann
  1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2014-09-05 10:11 UTC (permalink / raw)
  To: Chen Fan; +Cc: qemu-devel

On Di, 2014-09-02 at 14:33 +0800, Chen Fan wrote:
>  this memory leak is introduced by the original
>  commit 3158a3482b0093e41f2b2596fba50774ea31ae08

added to gtk queue.

thanks,
  Gerd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-05 10:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-02  6:33 [Qemu-devel] [PATCH] gtk.c: Fix memory leak in gd_set_keycode_type() Chen Fan
2014-09-04  1:10 ` chen.fan.fnst
2014-09-05 10:11 ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.