command must be freed - makes valgrind happy trivial changes to the debian build process
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:42:19 +0100
changeset 29 08ec6ddd6eea
parent 28 ef929533d040
child 30 eed9f710ba3b
command must be freed - makes valgrind happy trivial changes to the debian build process committer: Markus Bröker <mbroeker@largo.homelinux.org>
debian/changelog
debian/rules
src/irc.c
src/main.c
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-mcbot (0.96-2) unstable; urgency=low
+mcbot (0.96-3) unstable; urgency=low
 
   * Initial Release
   * the location of mcbot.cgi is stored in the db
@@ -27,5 +27,6 @@
   * mcbot.cgi installation defaults to /usr/lib/cgi-bin
   * Build Dependency Check improved.
   * Lintian Build Checks
+  * command must be freed on error - makes valgrind happy
 
  -- Markus Broeker <mbroeker@largo.homelinux.org>  Sun, 24 Aug 2008 20:30:00 +0200
--- a/debian/rules
+++ b/debian/rules
@@ -17,7 +17,6 @@
 	dh_testdir
 	# Add here commands to configure the package.
 
-	cmake src/
 	touch configure-stamp
 
 
@@ -38,8 +37,7 @@
 	rm -f build-stamp configure-stamp
 
 	# Add here commands to clean up after the build process.
-	if [ -f Makefile ]; then $(MAKE) clean; fi
-	rm -rf Makefile CMake* install* mcbot dbtool cmake_install.cmake
+	$(MAKE) distclean
 	dh_clean 
 
 install: build
--- a/src/irc.c
+++ b/src/irc.c
@@ -252,8 +252,10 @@
                     return NULL;
 #endif
                 case ENOMEM:
+                    return "ENOMEM";
                 case ERROR:
-                    return command;
+                    free (command);
+                    return "ERROR";
                 case VERSION:
                     if ((ptr = strchr (message->user, ' ')))
                         *ptr = '\0';
--- a/src/main.c
+++ b/src/main.c
@@ -99,8 +99,9 @@
 
         if ((command = irc_parsemessage (buf, &message))) {
             printf ("%10s %s %s\n", command, message.channel, message.line);
-            if (!strcmp (command, "ERROR") || !strcmp (command, "ENOMEM"))
+            if (!strcmp (command, "ERROR") || !strcmp (command, "ENOMEM")) {
                 break;
+            }
         } else {
             if ((msg = parse (&message)) != NULL) {
                 fprintf (message.stream, "%s\r\n", msg);