[Nautilus-list] [PATCH]: memory leak fix.
- From: Yoann Vandoorselaere <yoann mandrakesoft com>
- To: nautilus-list lists eazel com
- Cc: Darin Adler <darin bentspoon com>
- Subject: [Nautilus-list] [PATCH]: memory leak fix.
- Date: 27 Aug 2001 22:27:47 +0200
Hi,
here is a patch that fix several leak, and some unneeded operations :
can I commit ?
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 ?
--
Yoann Vandoorselaere
http://prelude.sourceforge.net
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4739
diff -u -p -r1.4739 ChangeLog
--- ChangeLog 2001/08/27 15:18:29 1.4739
+++ ChangeLog 2001/08/27 20:22:32
@@ -1,5 +1,19 @@
2001-08-27 Yoann Vandoorselaere <yoann mandrakesoft com>
+ * libnautilus-private/nautilus-link.c (nautilus_link_local_get_image_uri):
+ avoid un-needed string copy.
+
+ * components/help/hyperbola-filefmt.c (locale_score):
+ free return of xmlGetProp on return. Do not use a char pointer
+ to point on the returned value, use an xmlChar pointer.
+
+ * libnautilus-private/nautilus-link.c (nautilus_link_local_get_link_type):
+ Free the value returned by local_get_root_property.
+
+ 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 *.
+
* src/nautilus-switchable-search-bar.c (nautilus_switchable_search_bar_new):
Don't leak a GtkBox.
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;
}
Index: libnautilus-private/nautilus-link.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-link.c,v
retrieving revision 1.58
diff -u -p -r1.58 nautilus-link.c
--- libnautilus-private/nautilus-link.c 2001/08/27 15:18:31 1.58
+++ libnautilus-private/nautilus-link.c 2001/08/27 20:22:35
@@ -437,11 +437,10 @@ nautilus_link_local_get_image_uri (const
/* load it asynchronously through gnome-vfs */
info = g_new0 (NautilusLinkIconNotificationInfo, 1);
info->link_uri = gnome_vfs_get_uri_from_local_path (path);
- info->file_path = g_strdup (local_path);
+ info->file_path = local_path;
eel_read_entire_file_async (icon_uri, icon_read_done_callback, info);
g_free (icon_uri);
- g_free (local_path);
return NULL; /* return NULL since the icon is still loading - it will get correctly set by the callback */
}
@@ -459,7 +458,14 @@ nautilus_link_local_get_link_uri (const
NautilusLinkType
nautilus_link_local_get_link_type (const char *path)
{
- return get_link_type (local_get_root_property (path, "nautilus_link"));
+ char *property;
+ NautilusLinkType type;
+
+ property = local_get_root_property (path, "nautilus_link");
+ type = get_link_type (property);
+ g_free(property);
+
+ return type;
}
/* FIXME bugzilla.eazel.com 2495:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]