aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/ephy-dnd.c8
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a5d72b88c..c5f7d0431 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2003-07-13 Christian Persch <chpe@cvs.gnome.org>
+ * lib/ephy-dnd.c: (ephy_dnd_node_list_extract_nodes):
+
+ Fix mem leak and add safety check.
+
+2003-07-13 Christian Persch <chpe@cvs.gnome.org>
+
* src/language-editor.c: (language_editor_remove_button_clicked_cb):
* embed/downloader-view.c: (downloader_view_set_download_info),
(downloader_view_remove_download),
diff --git a/lib/ephy-dnd.c b/lib/ephy-dnd.c
index 75fb895d5..4bf9cd2cd 100644
--- a/lib/ephy-dnd.c
+++ b/lib/ephy-dnd.c
@@ -117,7 +117,7 @@ ephy_dnd_node_list_extract_nodes (const char *node_list)
nodes = g_strsplit (node_list, ";", -1);
- for (i = 0; nodes[i] != NULL; i = i + 2)
+ for (i = 0; nodes[i] != NULL && nodes[i+1] != NULL; i = i + 2)
{
gulong id;
EphyNodeDb *db;
@@ -131,9 +131,13 @@ ephy_dnd_node_list_extract_nodes (const char *node_list)
node = ephy_node_db_get_node_from_id (db, id);
g_return_val_if_fail (node != NULL, NULL);
- result = g_list_append (result, node);
+ result = g_list_prepend (result, node);
}
}
+ result = g_list_reverse (result);
+
+ g_strfreev (nodes);
+
return result;
}