A simple garbage collector fills the memory leaks...
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:40:22 +0100
changeset 12 213c3d4abc66
parent 11 a769385a59c6
child 13 d3554afaa768
A simple garbage collector fills the memory leaks... committer: Markus Bröker <mbroeker@largo.homelinux.org>
debian/changelog
src/irc.c
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mcbot (0.94-3) unstable; urgency=low
+mcbot (0.94-4) unstable; urgency=low
 
   * Initial Release
   * the location of mcbot.cgi is stored in the db
@@ -10,5 +10,6 @@
   * Debian Policy: Assume everything is working and start the service via default
   * irc_login connects now to the proper (non-freenode.net) server
   * privmsgs will be send to the proper location...
+  * A simple garbage collector fills the memory leaks...
 
- -- Markus Broeker <mbroeker@largo.homelinux.org>  Sat, 9 Aug 2008 18:05:54 +0200
+ -- Markus Broeker <mbroeker@largo.homelinux.org>  Sat, 10 Aug 2008 16:48:54 +0200
--- a/src/irc.c
+++ b/src/irc.c
@@ -142,12 +142,18 @@
 
 static char *irc_getmessage (const char *line, MSG * message)
 {
+    static char *garbage_collector = NULL;
     char *theLine;
     char *token;
     char *ptr;
 
+    if (garbage_collector != NULL)
+        free (garbage_collector);
+
     if ((theLine = strdup (line)) == NULL)
         return "ENOMEM";
+    else
+        garbage_collector = theLine;
 
     message->user = message->email = NULL;
     message->command = NULL;