Fix two authorization stage memory leaks.
authorMichael Poole <mdpoole@troilus.org>
Fri, 30 Jun 2006 15:52:18 +0000 (15:52 +0000)
committerMichael Poole <mdpoole@troilus.org>
Fri, 30 Jun 2006 15:52:18 +0000 (15:52 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1684 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/s_auth.c

index a054c40347c1e275621cbf9e5692f7abad172263..b86892f87e968cbcf18f5d5536f96cee0d6c9f87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-30  Michael Poole <mdpoole@troilus.org>
+
+       * 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 <mdpoole@troilus.org>
 
        * include/patchlevel.h (PATCHLEVEL): Bump for pre08.
index d512b63f11d7a789febd5e6c6b00b8a15d49e17e..e2aa5d7c6bae9c5376a3c840d234f6b1d5c2ca9c 100644 (file)
@@ -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;
 }