aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e-util/ChangeLog6
-rw-r--r--e-util/e-pilot-map.c31
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);
}