X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=apps%2Fsilcd%2Fidlist.c;h=40b9041caaafee09f3b3d36f3e64168429b7972e;hp=502744eb3e9ad2400e866b0285331dbf7db7e34d;hb=1eb298744baad994b2a6cda057c9125e27729e6f;hpb=da1c3bc287b33b27277030d0bd7b9bf0753228be diff --git a/apps/silcd/idlist.c b/apps/silcd/idlist.c index 502744eb..40b9041c 100644 --- a/apps/silcd/idlist.c +++ b/apps/silcd/idlist.c @@ -605,6 +605,9 @@ static void silc_idlist_del_channel_foreach(void *key, void *context, { SilcChannelClientEntry chl = (SilcChannelClientEntry)context; + SILC_LOG_DEBUG(("Removing client %s from channel %s", + chl->client->nickname, chl->channel->channel_name)); + /* Remove the context from the client's channel hash table as that table and channel's user_list hash table share this same context. */ silc_hash_table_del(chl->client->channels, chl->channel); @@ -623,6 +626,13 @@ int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry) if (!silc_idcache_del_by_id(id_list->channels, (void *)entry->id)) return FALSE; + /* Free all client entrys from the users list. The silc_hash_table_free + will free all the entries so they are not freed at the foreach + callback. */ + silc_hash_table_foreach(entry->user_list, silc_idlist_del_channel_foreach, + NULL); + silc_hash_table_free(entry->user_list); + /* Free data */ silc_free(entry->channel_name); silc_free(entry->id); @@ -639,13 +649,6 @@ int silc_idlist_del_channel(SilcIDList id_list, SilcChannelEntry entry) silc_free(entry->hmac_name); silc_free(entry->rekey); - /* Free all client entrys from the users list. The silc_hash_table_free - will free all the entries so they are not freed at the foreach - callback. */ - silc_hash_table_foreach(entry->user_list, silc_idlist_del_channel_foreach, - NULL); - silc_hash_table_free(entry->user_list); - memset(entry, 'F', sizeof(*entry)); silc_free(entry); return TRUE; @@ -663,7 +666,7 @@ silc_idlist_find_channel_by_name(SilcIDList id_list, char *name, { SilcIDCacheEntry id_cache = NULL; - SILC_LOG_DEBUG(("Channel by name")); + SILC_LOG_DEBUG(("Channel by name %s", name)); if (!silc_idcache_find_by_name_one(id_list->channels, name, &id_cache)) return NULL;