Re: [Evolution-hackers] Fix for "agressive" memory segmentation
Philip Van Hoof <[email protected]>
| Newsgroups | gmane.comp.gnome.evolution.patches,gmane.comp.gnome.evolution.devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 2006-07-06 at 15:18 -0400, Jeffrey Stedfast wrote: > For some strange reason I thought the pstring stuff already did that, > oops. I guess I was thinking of similar code I wrote a few years back > for another project... > > This patch does it the way I had done it in another project of mine My other message got blocked because it was to big (it contained some valgrind reports) I'll re-post the patch only to the mailing list. Feel free to release the original message also. This fixes a huge memory leak in fejjs new code ;-). Little oeps I guess (every duplicate string got leaked or something afaics). -- Philip Van Hoof, software developer at x-tend home: me at pvanhoof dot be gnome: pvanhoof at gnome dot org work: vanhoof at x-tend dot be http://www.pvanhoof.be - http://www.x-tend.be _______________________________________________ Evolution-patches mailing list [email protected] http://mail.gnome.org/mailman/listinfo/evolution-patches
fix.diff
(text/x-patch, 902 B)
? camel-mime-tables.c
Index: camel-string-utils.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/camel-string-utils.c,v
retrieving revision 1.6
diff -u -r1.6 camel-string-utils.c
--- camel-string-utils.c 6 Jul 2006 19:43:47 -0000 1.6
+++ camel-string-utils.c 6 Jul 2006 21:34:32 -0000
@@ -164,10 +164,10 @@
char *pstr;
int count;
- if (s == NULL)
+ if (str == NULL)
return NULL;
- if (s[0] == '\0') {
+ if (str[0] == '\0') {
if (own)
g_free (str);
return "";
@@ -180,6 +180,7 @@
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));
+ g_free (str);
} else {
pstr = own ? str : g_strdup (str);
g_hash_table_insert (pstring_table, pstr, GINT_TO_POINTER (1));