[gtk] imwayland: Fix a small leak



commit 7869ffbb49cf99fcf7c4a7f1b4925262991d1e5d
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sun Jun 24 15:49:46 2018 -0500

    imwayland: Fix a small leak
    
    If the parent get_preedit_string implementation returns a nonnull
    zero-length string, then we ignore it, which is almost fine. We have to
    free it, though.
    
    Fixes #1174

 gtk/gtkimcontextwayland.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkimcontextwayland.c b/gtk/gtkimcontextwayland.c
index e9cc6a6eb2..141ad6c6c9 100644
--- a/gtk/gtkimcontextwayland.c
+++ b/gtk/gtkimcontextwayland.c
@@ -472,8 +472,13 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext   *context,
   GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->get_preedit_string (context, str, attrs, 
cursor_pos);
 
   /* If the parent implementation returns a len>0 string, go with it */
-  if (str && *str && **str)
-    return;
+  if (str && *str)
+    {
+      if (**str)
+        return;
+
+      g_free (*str);
+    }
 
   preedit_str =
     context_wayland->preedit.text ? context_wayland->preedit.text : "";


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