# HG changeset patch # User Mark Doliner # Date 1211318148 0 # Node ID b0c9276bff93b04be8677249c5c96b3279912277 # Parent ba47ec8a2477ad642ded83c645f0b35b8aa431d0 Borrow a reference to a string instead of g_strdup'ing it. The PurpleStatus should ALWAYS be destroyed before the PurpleStatusType, so this should be ok. Yes, this is just one little string. But we copy every attribute for every PurpleStatus for every buddy on your buddylist--it adds up. diff -r ba47ec8a2477 -r b0c9276bff93 libpurple/status.c --- a/libpurple/status.c Tue May 20 20:59:21 2008 +0000 +++ b/libpurple/status.c Tue May 20 21:15:48 2008 +0000 @@ -111,6 +111,12 @@ gboolean active; + /* + * The current values of the attributes for this status. The + * key is a string containing the name of the attribute. It is + * a borrowed reference from the list of attrs in the + * PurpleStatusType. The value is a PurpleValue. + */ GHashTable *attr_values; }; @@ -563,7 +569,7 @@ status->presence = presence; status->attr_values = - g_hash_table_new_full(g_str_hash, g_str_equal, g_free, + g_hash_table_new_full(g_str_hash, g_str_equal, NULL, (GDestroyNotify)purple_value_destroy); for (l = purple_status_type_get_attrs(status_type); l != NULL; l = l->next) @@ -573,7 +579,7 @@ PurpleValue *new_value = purple_value_dup(value); g_hash_table_insert(status->attr_values, - g_strdup(purple_status_attr_get_id(attr)), + (char *)purple_status_attr_get_id(attr), new_value); }