From 36ac7709edfdb9053ea3ea67f0c2b4297f24a87c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 7 Jul 2006 15:03:53 +0000 Subject: If the value is in the table already and 'own' is TRUE, g_free the 2006-07-07 Jeffrey Stedfast * camel-string-utils.c (camel_pstring_add): If the value is in the table already and 'own' is TRUE, g_free the passed-in string. --- camel/ChangeLog | 5 +++++ camel/camel-string-utils.c | 2 ++ 2 files changed, 7 insertions(+) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index a760a329f..3fdb419c5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2006-07-07 Jeffrey Stedfast + + * camel-string-utils.c (camel_pstring_add): If the value is in the + table already and 'own' is TRUE, g_free the passed-in string. + 2006-07-07 Sankar P * camel-string-utils.c (camel_pstring_add): diff --git a/camel/camel-string-utils.c b/camel/camel-string-utils.c index f5718514b..61137bb37 100644 --- a/camel/camel-string-utils.c +++ b/camel/camel-string-utils.c @@ -180,6 +180,8 @@ camel_pstring_add (char *str, gboolean own) if (g_hash_table_lookup_extended (pstring_table, str, (void **) &pstr, &pcount)) { count = GPOINTER_TO_INT (pcount) + 1; g_hash_table_insert (pstring_table, pstr, GINT_TO_POINTER (count)); + if (own) + g_free (str); } else { pstr = own ? str : g_strdup (str); g_hash_table_insert (pstring_table, pstr, GINT_TO_POINTER (1)); -- cgit v1.2.1