[perl-Glib] Glib::Object: fix a leak



commit ba24f099d50ecb142d782a64ae0f5c111afee4c0
Author: Kevin Ryde <user42 zip com au>
Date:   Thu Sep 2 08:48:04 2010 +1000

    Glib::Object: fix a leak
    
    Free g_object_class_list_properties() and g_object_interface_list_properties()
    return array even when n_props==0. Fixes memory leak if list_properties() used
    on an object or interface which has no properties.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=628564

 GObject.xs |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/GObject.xs b/GObject.xs
index d367fe9..a286f4f 100644
--- a/GObject.xs
+++ b/GObject.xs
@@ -1487,8 +1487,8 @@ g_object_find_property (object_or_class_name, ...)
 				for (i = 0; i < n_props; i++)
 					PUSHs (sv_2mortal (newSVGParamSpec (props[i])));
 
-				g_free (props);
 			}
+			g_free (props); /* must free even when n_props==0 */
 		}
 
 		g_type_class_unref (object_class);
@@ -1521,8 +1521,8 @@ g_object_find_property (object_or_class_name, ...)
 				for (i = 0; i < n_props; i++)
 					PUSHs (sv_2mortal (newSVGParamSpec (props[i])));
 
-				g_free (props);
 			}
+			g_free (props); /* must free even when n_props==0 */
 		}
 
 		g_type_default_interface_unref (iface);



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