- Added some tools to detect memory leaks.
[ircu2.10.12-pk.git] / ircd / m_away.c
index cf4efe0babb42dce7ed65746eab5daa90e425255..b926a6aa0c2b3b97d2e5d08bccb2be7a5a2d663a 100644 (file)
@@ -93,6 +93,7 @@
 #include "send.h"
 
 #include <assert.h>
+#include <string.h>
 
 /*
  * user_set_away - set user away state
@@ -123,14 +124,13 @@ static int user_set_away(struct User* user, char* message)
      */
     unsigned int len = strlen(message);
 
-    if (len > TOPICLEN) {
-      message[TOPICLEN] = '\0';
-      len = TOPICLEN;
+    if (len > AWAYLEN) {
+      message[AWAYLEN] = '\0';
+      len = AWAYLEN;
     }
     if (away)
-      away = (char*) MyRealloc(away, len + 1);
-    else
-      away = (char*) MyMalloc(len + 1);
+      MyFree(away);
+    away = (char*) MyMalloc(len + 1);
     assert(0 != away);
 
     user->away = away;