[glib/wip/gproperty: 20/28] gproperty: Return a copy of the interned string when canonicalizing



commit d1d4e3dd0fa380dd96d3e7b5e19527493ca9fc95
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]