[gtk/matthiasc/for-master] shortcuttrigger: Fix some leaks in error paths



commit 26a23d3e56b0ddfc63039f302a3fcc15cd72cbac
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jul 8 17:42:29 2020 -0400

    shortcuttrigger: Fix some leaks in error paths
    
    Found while running the testsuite under asan.

 gtk/gtkshortcuttrigger.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkshortcuttrigger.c b/gtk/gtkshortcuttrigger.c
index 15268ef464..65e3164b5b 100644
--- a/gtk/gtkshortcuttrigger.c
+++ b/gtk/gtkshortcuttrigger.c
@@ -142,11 +142,17 @@ gtk_shortcut_trigger_parse_string (const char *string)
 
       /* empty first slot */
       if (*frag_a == '\0')
-        return NULL;
+        {
+          g_free (frag_a);
+          return NULL;
+        }
 
       /* empty second slot */
       if (*frag_b == '\0')
-        return NULL;
+        {
+          g_free (frag_a);
+          return NULL;
+        }
 
       t1 = gtk_shortcut_trigger_parse_string (frag_a);
       if (t1 == NULL)


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