diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-07-14 01:05:41 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-07-14 01:05:41 +0800 |
commit | 966d9b7893671364b2ae8c04c82c93596390e264 (patch) | |
tree | 1f609e73c152db3982f8df06a6dbea97afb8f25d /lib/ephy-dnd.c | |
parent | 4bf4f76bffb2f7eb18672d26aace9c097b439fb9 (diff) | |
download | gsoc2013-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.
Diffstat (limited to 'lib/ephy-dnd.c')
-rw-r--r-- | lib/ephy-dnd.c | 8 |
1 files changed, 6 insertions, 2 deletions
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; } |