aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-07-14 01:05:41 +0800
committerChristian Persch <chpe@src.gnome.org>2003-07-14 01:05:41 +0800
commit966d9b7893671364b2ae8c04c82c93596390e264 (patch)
tree1f609e73c152db3982f8df06a6dbea97afb8f25d
parent4bf4f76bffb2f7eb18672d26aace9c097b439fb9 (diff)
downloadgsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar.gz
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar.bz2
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar.lz
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar.xz
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.tar.zst
gsoc2013-epiphany-966d9b7893671364b2ae8c04c82c93596390e264.zip
Fix mem leak and add safety check.
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.
-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;
}