[at-spi2-core/gnome-42] impl_deregister_keystroke_listener: Fix kd structure leak on iteration error



commit e5e2f2954e46468ee507883fad59f2cca44bb4d4
Author: Samuel Thibault <samuel thibault ens-lyon org>
Date:   Sun Mar 13 23:59:13 2022 +0100

    impl_deregister_keystroke_listener: Fix kd structure leak on iteration error

 registryd/deviceeventcontroller.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/registryd/deviceeventcontroller.c b/registryd/deviceeventcontroller.c
index 0c755a02..0fe65556 100644
--- a/registryd/deviceeventcontroller.c
+++ b/registryd/deviceeventcontroller.c
@@ -1390,6 +1390,7 @@ impl_register_keystroke_listener (DBusConnection *bus,
     Accessibility_KeyDefinition *kd = (Accessibility_KeyDefinition 
*)g_malloc(sizeof(Accessibility_KeyDefinition));
     if (!spi_dbus_message_iter_get_struct(&iter_array, DBUS_TYPE_INT32, &kd->keycode, DBUS_TYPE_INT32, 
&kd->keysym, DBUS_TYPE_STRING, &keystring, DBUS_TYPE_INVALID))
     {
+      g_free(kd);
       break;
     }
     kd->keystring = g_strdup (keystring);
@@ -1600,6 +1601,7 @@ impl_deregister_keystroke_listener (DBusConnection *bus,
 
     if (!spi_dbus_message_iter_get_struct(&iter_array, DBUS_TYPE_INT32, &kd->keycode, DBUS_TYPE_INT32, 
&kd->keysym, DBUS_TYPE_STRING, &keystring, DBUS_TYPE_INVALID))
     {
+      g_free(kd);
       break;
     }
     kd->keystring = g_strdup (keystring);


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