Fix memory leaks from ircd_crypt and epoll support.
[ircu2.10.12-pk.git] / ircd / m_oper.c
index 47ee82570354aa19ed89399028fe3a8a6c082d63..d0e85a12e3f0bc1dc5a7e2d8548ba999ace556b7 100644 (file)
@@ -84,6 +84,7 @@
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_alloc.h"
 #include "ircd_features.h"
 #include "ircd_log.h"
 #include "ircd_reply.h"
 
 int oper_password_match(const char* to_match, const char* passwd)
 {
+  char *crypted;
+  int res;
   /*
    * use first two chars of the password they send in as salt
    *
@@ -116,12 +119,13 @@ int oper_password_match(const char* to_match, const char* passwd)
   /* we no longer do a CRYPT_OPER_PASSWORD check because a clear 
      text passwords just handled by a fallback mechanism called 
      crypt_clear if it's enabled -- hikari */
-  to_match = ircd_crypt(to_match, passwd);
+  crypted = ircd_crypt(to_match, passwd);
 
   if (to_match == NULL)
    return 0;
-  else
-   return (0 == strcmp(to_match, passwd));
+  res = strcmp(crypted, passwd);
+  MyFree(crypted);
+  return 0 == res;
 }
 
 /*