[gthumb/ext] [PATCH] don't access freed memory and don't leak memory
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] [PATCH] don't access freed memory and don't leak memory
- Date: Wed, 30 Sep 2009 13:25:21 +0000 (UTC)
commit eeeb67cc6ca9454a2a7181551162bcd2301bcb0a
Author: Geoffrey <dynamotwain aim com>
Date: Wed Sep 30 15:24:20 2009 +0200
[PATCH] don't access freed memory and don't leak memory
gthumb/gth-extensions.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/gthumb/gth-extensions.c b/gthumb/gth-extensions.c
index e4bae09..bee2e8c 100644
--- a/gthumb/gth-extensions.c
+++ b/gthumb/gth-extensions.c
@@ -872,38 +872,39 @@ gth_extension_manager_order_extensions (GthExtensionManager *manager,
GSList *ordered = NULL;
for (scan = extensions; scan; /* void */) {
- GSList *next = scan->next;
- GSList *slink;
char *ext_name = scan->data;
GthExtensionDescription *ext_description;
+ GSList *next = scan->next;
GList *dependencies;
+ GSList *slink;
GList *scan_d;
ext_description = g_hash_table_lookup (manager->priv->extensions, ext_name);
if (ext_description == NULL) {
- scan = scan->next;
+ g_free (scan->data);
+ extensions = g_slist_delete_link (extensions, scan);
+ scan = next;
continue;
}
dependencies = get_extension_optional_dependencies (manager, ext_description);
for (scan_d = dependencies; scan_d; scan_d = scan_d->next) {
- char *dep_name = scan_d->data;
+ char *dep_name = scan_d->data;
slink = g_slist_find_custom (extensions, dep_name, (GCompareFunc) strcmp);
if (slink != NULL) {
- extensions = g_slist_remove_link (extensions, slink);
- ordered = g_slist_prepend (ordered, slink->data);
+ if (slink == next)
+ next = next->next;
- g_slist_free (slink);
+ extensions = g_slist_remove_link (extensions, slink);
+ slink->next = ordered;
+ ordered = slink;
}
}
- slink = scan;
- extensions = g_slist_remove_link (extensions, slink);
- g_slist_free (slink);
-
- ordered = g_slist_prepend (ordered, ext_name);
-
+ extensions = g_slist_remove_link (extensions, scan);
+ scan->next = ordered;
+ ordered = scan;
scan = next;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]