Re: [Nautilus-list] [PATCH]: memory leak fix.
- From: Darin Adler <darin bentspoon com>
- To: Yoann Vandoorselaere <yoann mandrakesoft com>
- Cc: nautilus-list lists eazel com
- Subject: Re: [Nautilus-list] [PATCH]: memory leak fix.
- Date: Mon, 27 Aug 2001 14:34:48 -0700
On Monday, August 27, 2001, at 01:27 PM, Yoann Vandoorselaere wrote:
here is a patch that fix several leak, and some unneeded operations :
can I commit ?
You need to fix some small things first.
Index: components/help/hyperbola-filefmt.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/help/hyperbola-filefmt.c,v
retrieving revision 1.35
diff -u -p -r1.35 hyperbola-filefmt.c
--- components/help/hyperbola-filefmt.c 2001/05/11 01:30:26 1.35
+++ components/help/hyperbola-filefmt.c 2001/08/27 20:22:33
@@ -1545,7 +1545,7 @@ static int
locale_score (GList *locales, xmlNode *doc_node)
{
GList *li;
- char *locale;
+ xmlChar *locale;
int score;
if (doc_node == NULL)
@@ -1559,11 +1559,14 @@ locale_score (GList *locales, xmlNode *d
score = 0;
for (li = locales; li != NULL; li = li->next) {
if (strcmp (locale, (char *) li->data) == 0) {
- return score;
+ xmlFree(locale);
+ return score;
}
score++;
}
+
+ xmlFree(locale);
return -1;
}
After this change, the code can call xmlFree on the string constant "C".
Please fix that. Also, please use a space after the name of a function
before the parameter list when changing Nautilus source code. Use "xmlFree
(x)", not "xmlFree(x)".
+ g_free(property);
Again, you need that space here.
+ BTW : xml_get_root_property() is called from local_get_root_property()
+ which itself call xmlGetProp. The value is then copied in a string
pointer.
+ This copie is not needed and we could as well return an xmlChar *.
This comment doesn't belong in the change log.
BTW, shouldn't refresh_stored_viewers() in nautilus-window.c take care
of freeing each node->data ? Or does
gnome_vfs_mime_component_list_free() take care of it ?
Yes, it does. But you shouldn't have to ask. You have the source code to
gnome_vfs_mime_component_list_free, so you can check for yourself.
-- Darin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]