From 6eddc760e39b286b0b417e6b16d291bfae517806 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Fri, 30 Jun 2006 15:52:18 +0000 Subject: [PATCH] Fix two authorization stage memory leaks. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1684 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 6 ++++++ ircd/s_auth.c | 13 +++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a054c40..b86892f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-06-30 Michael Poole + + * ircd/s_auth.c (check_auth_finished): Free auth structure when + done with it. + (sendto_iauth): Free message buffer when done with it. + 2006-06-26 Michael Poole * include/patchlevel.h (PATCHLEVEL): Bump for pre08. diff --git a/ircd/s_auth.c b/ircd/s_auth.c index d512b63..e2aa5d7 100644 --- a/ircd/s_auth.c +++ b/ircd/s_auth.c @@ -427,11 +427,15 @@ static int check_auth_finished(struct AuthRequest *auth) destroy_auth_request(auth); if (!IsUserPort(auth->client)) - return 0; - memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client))); - res = auth_set_username(auth); - if (res == 0) + { + memset(cli_passwd(auth->client), 0, sizeof(cli_passwd(auth->client))); + res = auth_set_username(auth); + if (res == 0) res = register_user(auth->client, auth->client); + } + else + res = 0; + MyFree(auth); return res; } @@ -1399,6 +1403,7 @@ static int sendto_iauth(struct Client *cptr, const char *format, ...) /* Tack it onto the iauth sendq and try to write it. */ ++iauth->i_sendM; msgq_add(i_sendQ(iauth), mb, 0); + msgq_clean(mb); iauth_write(iauth); return 1; } -- 2.20.1