{
SILC_LOG_DEBUG(("Stopping client"));
+ if (!silc_fsm_is_started(&client->internal->fsm)) {
+ SILC_LOG_WARNING(("Attempting to stop client library before it has been "
+ "started (silc_client_init not called)"));
+ return;
+ }
+
client->internal->running = (SilcClientRunning)stopped;
client->internal->running_context = context;
SilcChannelEntry channel)
{
SilcIDCacheEntry id_cache;
- SilcBool ret;
+ SilcBool ret = TRUE;
SilcCipher key;
SilcHmac hmac;
+ char *namec;
if (!channel)
return FALSE;
silc_mutex_lock(conn->internal->lock);
if (silc_idcache_find_by_context(conn->internal->channel_cache, channel,
- &id_cache))
- silc_free(id_cache->name);
- ret = silc_idcache_del_by_context(conn->internal->channel_cache,
- channel, NULL);
+ &id_cache)) {
+ namec = id_cache->name;
+ ret = silc_idcache_del_by_context(conn->internal->channel_cache,
+ channel, NULL);
+ silc_free(namec);
+ }
silc_mutex_unlock(conn->internal->lock);
if (!ret)
SilcServerEntry server)
{
SilcIDCacheEntry id_cache;
- SilcBool ret;
+ SilcBool ret = TRUE;
+ char *namec;
if (!server)
return FALSE;
silc_mutex_lock(conn->internal->lock);
if (silc_idcache_find_by_context(conn->internal->server_cache, server,
- &id_cache))
- silc_free(id_cache->name);
- ret = silc_idcache_del_by_context(conn->internal->server_cache,
- server, NULL);
+ &id_cache)) {
+ namec = id_cache->name;
+ ret = silc_idcache_del_by_context(conn->internal->server_cache,
+ server, NULL);
+ silc_free(namec);
+ }
silc_mutex_unlock(conn->internal->lock);
silc_free(server->server_name);