From 6afc7e110e395414d327f511e130d4ad31024af6 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Mon, 28 Oct 2002 19:52:07 +0000 Subject: [PATCH] Fixed memory leak in JOIN command reply. --- apps/silcd/command_reply.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index ff36562e..fd3a7d6b 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -965,6 +965,7 @@ SILC_SERVER_CMD_REPLY_FUNC(join) silc_free(id); goto out; } + hmac = NULL; server->stat.my_channels++; server->stat.channels++; } else { @@ -991,9 +992,9 @@ SILC_SERVER_CMD_REPLY_FUNC(join) founder_key = NULL; } - if (entry->hmac_name && hmac) { + if (entry->hmac_name && (hmac || (!hmac && entry->hmac))) { silc_free(entry->hmac_name); - entry->hmac_name = strdup(silc_hmac_get_name(hmac)); + entry->hmac_name = strdup(silc_hmac_get_name(hmac ? hmac : entry->hmac)); } /* Get the ban list */ @@ -1047,6 +1048,8 @@ SILC_SERVER_CMD_REPLY_FUNC(join) out: SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_JOIN); err: + if (hmac) + silc_hmac_free(hmac); silc_free(client_id); silc_server_command_reply_free(cmd); -- 2.24.0