diff options
author | JP Rosevear <jpr@ximian.com> | 2001-10-29 10:33:16 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-10-29 10:33:16 +0800 |
commit | 891310bddb462fec2a8bd196fc038af5bf857fa5 (patch) | |
tree | d1814d58dbfcbaa753add333a3efef1c67a863e9 | |
parent | 3b397a352fe203284c7442d0b057e3443027bcab (diff) | |
download | gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.gz gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.bz2 gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.lz gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.xz gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.zst gsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.zip |
make sure to free the keys as well (e_pilot_map_remove_by_uid): ditto
2001-10-28 JP Rosevear <jpr@ximian.com>
* e-pilot-map.c (e_pilot_map_remove_by_pid): make sure to free the
keys as well
(e_pilot_map_remove_by_uid): ditto
svn path=/trunk/; revision=14315
-rw-r--r-- | e-util/ChangeLog | 6 | ||||
-rw-r--r-- | e-util/e-pilot-map.c | 31 |
2 files changed, 25 insertions, 12 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 0d7e4d9da7..74d2423750 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,9 @@ +2001-10-28 JP Rosevear <jpr@ximian.com> + + * e-pilot-map.c (e_pilot_map_remove_by_pid): make sure to free the + keys as well + (e_pilot_map_remove_by_uid): ditto + 2001-10-27 JP Rosevear <jpr@ximian.com> * e-pilot-map.h: update proto diff --git a/e-util/e-pilot-map.c b/e-util/e-pilot-map.c index 01a1552e4f..b1b4e80052 100644 --- a/e-util/e-pilot-map.c +++ b/e-util/e-pilot-map.c @@ -216,20 +216,25 @@ e_pilot_map_insert (EPilotMap *map, guint32 pid, const char *uid, gboolean archi void e_pilot_map_remove_by_pid (EPilotMap *map, guint32 pid) { - EPilotMapPidNode *pnode; - EPilotMapUidNode *unode; - + EPilotMapPidNode *pnode = NULL; + EPilotMapUidNode *unode = NULL; + gpointer pkey, ukey; + g_return_if_fail (map != NULL); - pnode = g_hash_table_lookup (map->pid_map, &pid); - if (!pnode) + if (!g_hash_table_lookup_extended (map->pid_map, &pid, + &pkey, (gpointer *)&pnode)) return; - unode = g_hash_table_lookup (map->uid_map, pnode->uid); - + g_hash_table_lookup_extended (map->uid_map, pnode->uid, &ukey, + (gpointer *)&unode); + g_assert (unode != NULL); + g_hash_table_remove (map->pid_map, &pid); g_hash_table_remove (map->uid_map, pnode->uid); + g_free (pkey); + g_free (ukey); g_free (pnode); g_free (unode); } @@ -239,21 +244,23 @@ e_pilot_map_remove_by_uid (EPilotMap *map, const char *uid) { EPilotMapPidNode *pnode; EPilotMapUidNode *unode; - + gpointer pkey, ukey; + g_return_if_fail (map != NULL); g_return_if_fail (uid != NULL); - unode = g_hash_table_lookup (map->uid_map, uid); - if (!unode) + if (!g_hash_table_lookup_extended (map->uid_map, uid, &ukey, (gpointer *)&unode)) return; - pnode = g_hash_table_lookup (map->pid_map, &unode->pid); + g_hash_table_lookup_extended (map->pid_map, &unode->pid, &pkey, (gpointer *)&pnode); g_hash_table_remove (map->uid_map, uid); g_hash_table_remove (map->pid_map, &unode->pid); - g_free (unode); + g_free (pkey); + g_free (ukey); g_free (pnode); + g_free (unode); } |