aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-pilot-map.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-10-29 10:33:16 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-10-29 10:33:16 +0800
commit891310bddb462fec2a8bd196fc038af5bf857fa5 (patch)
treed1814d58dbfcbaa753add333a3efef1c67a863e9 /e-util/e-pilot-map.c
parent3b397a352fe203284c7442d0b057e3443027bcab (diff)
downloadgsoc2013-evolution-891310bddb462fec2a8bd196fc038af5bf857fa5.tar.gz
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
Diffstat (limited to 'e-util/e-pilot-map.c')
-rw-r--r--e-util/e-pilot-map.c31
1 files changed, 19 insertions, 12 deletions
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);
}