[clutter/clutter-1.22] x11: Plug a leak on error path



commit 51568b0ce4fc5a397556a66d485b1222ed758849
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Thu Apr 9 12:35:23 2015 +0100

    x11: Plug a leak on error path
    
    If XIGetProperty() does not return what we expect, but still returned
    something, we need to free it.
    
    (cherry picked from commit 877e58a6b4ecc6e634891d31c877fb2baf447a18)
    
    Signed-off-by: Emmanuele Bassi <ebassi gnome org>

 clutter/x11/clutter-device-manager-xi2.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/clutter/x11/clutter-device-manager-xi2.c b/clutter/x11/clutter-device-manager-xi2.c
index 1bad9d7..17c491e 100644
--- a/clutter/x11/clutter-device-manager-xi2.c
+++ b/clutter/x11/clutter-device-manager-xi2.c
@@ -255,7 +255,7 @@ get_device_ids (ClutterBackendX11  *backend_x11,
                 gchar             **product_id)
 {
   gulong nitems, bytes_after;
-  guint32 *data;
+  guint32 *data = NULL;
   int rc, format;
   Atom type;
 
@@ -268,7 +268,10 @@ get_device_ids (ClutterBackendX11  *backend_x11,
   clutter_x11_untrap_x_errors ();
 
   if (rc != Success || type != XA_INTEGER || format != 32 || nitems != 2)
-    return FALSE;
+    {
+      XFree (data);
+      return FALSE;
+    }
 
   if (vendor_id)
     *vendor_id = g_strdup_printf ("%.4x", data[0]);


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