[glib/g-property: 20/22] gproperty: Return a copy of the interned string when canonicalizing



commit a3eccbd41aca0601f5ef8941f22b7b8a0964e4dc
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Jul 7 12:52:05 2011 +0100

    gproperty: Return a copy of the interned string when canonicalizing
    
    The API contract says that we might modify the string, so we need to
    copy it to avoid a conditional g_free().

 gobject/gproperty.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gproperty.c b/gobject/gproperty.c
index 671a370..73072d5 100644
--- a/gobject/gproperty.c
+++ b/gobject/gproperty.c
@@ -3237,7 +3237,7 @@ g_property_canonicalize_name (const gchar *name)
   g_return_val_if_fail (name != NULL, NULL);
 
   if (is_canonical (name))
-    return g_intern_string (name);
+    return g_strdup (g_intern_string (name));
 
   retval = g_strdup (name);
   canonicalize_name (retval);



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