From 76b2090ea3960ac4768ea8e9722c3e00e4c8b185 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 25 Jan 2003 20:17:53 +0000 Subject: Fixed WHOWAS memory leak git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@147 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index b0d8d300b..194bd29c2 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -14,6 +14,9 @@ * --------------------------------------------------- $Log$ + Revision 1.3 2003/01/25 20:17:53 brain + Fixed WHOWAS memory leak + Revision 1.2 2003/01/25 20:00:45 brain Added /WHOWAS @@ -2803,18 +2806,23 @@ void AddWhoWas(userrec* u) // 3600 seconds in an hour ;) if ((i->second->signon)<(time(NULL)-(WHOWAS_STALE*3600))) { + delete i->second; i->second = a; debug("added WHOWAS entry, purged an old record"); return; } } } - debug("added fresh WHOWAS entry"); - whowas[a->nick] = a; + else + { + debug("added fresh WHOWAS entry"); + whowas[a->nick] = a; + } } else { debug("updated WHOWAS entry"); + delete iter->second; iter->second = a; } } -- cgit v1.2.3