diff -urN --exclude=Makefile.in --exclude=aclocal.m4 --exclude=autom4* --exclude=*~ --exclude=configure --exclude=target.h --exclude=Makefile --exclude=*.o --exclude=.deps --exclude=clamav-config.h clamav-devel.jm-pl4b.allocfixes.0/clamd/options.c clamav-devel.jm-pl5a/clamd/options.c
--- clamav-devel.jm-pl4b.allocfixes.0/clamd/options.c	Sun May 16 17:29:30 2004
+++ clamav-devel.jm-pl5a/clamd/options.c	Tue May 18 10:38:00 2004
@@ -37,6 +37,7 @@
 #include "others.h"
 #include "../libclamav/others.h"
 #include "memory.h"
+#include "../shared/cl_debug.h"
 
 void clamd(struct optstruct *opt);
 
@@ -58,6 +59,10 @@
 #if defined(C_LINUX) && defined(CL_DEBUG)
 	/* njh@bandsman.co.uk: create a dump if needed */
 	struct rlimit rlim;
+
+#ifdef CL_DEBUG
+    mtrace();
+#endif
 
     rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY;
     if(setrlimit(RLIMIT_CORE, &rlim) < 0)
diff -urN --exclude=Makefile.in --exclude=aclocal.m4 --exclude=autom4* --exclude=*~ --exclude=configure --exclude=target.h --exclude=Makefile --exclude=*.o --exclude=.deps --exclude=clamav-config.h clamav-devel.jm-pl4b.allocfixes.0/configure.in clamav-devel.jm-pl5a/configure.in
--- clamav-devel.jm-pl4b.allocfixes.0/configure.in	Sun May 16 20:02:18 2004
+++ clamav-devel.jm-pl5a/configure.in	Tue May 18 08:43:00 2004
@@ -143,7 +143,12 @@
 
 AC_ARG_ENABLE(debug,
 [  --enable-debug	  Enable debug messages.],
-AC_DEFINE(CL_DEBUG,1,[enable debugging]),)
+AC_DEFINE(CL_DEBUG,1,[enable debugging])
+LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lmcheck"
+CLAMD_LIBS="$CLAMD_LIBS -lmcheck"
+CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lmcheck"
+CLAMDSCAN_LIBS="$CLAMDSCAN_LIBS -lmcheck"
+,)
 
 AC_ARG_ENABLE(bigstack,
 [  --enable-bigstack	  Increase thread stack size.],
diff -urN --exclude=Makefile.in --exclude=aclocal.m4 --exclude=autom4* --exclude=*~ --exclude=configure --exclude=target.h --exclude=Makefile --exclude=*.o --exclude=.deps --exclude=clamav-config.h clamav-devel.jm-pl4b.allocfixes.0/libclamav/text.c clamav-devel.jm-pl5a/libclamav/text.c
--- clamav-devel.jm-pl4b.allocfixes.0/libclamav/text.c	Tue May 18 07:00:12 2004
+++ clamav-devel.jm-pl5a/libclamav/text.c	Wed May 19 08:45:00 2004
@@ -50,6 +50,7 @@
 #include "blob.h"
 #include "text.h"
 #include "others.h"
+#include "../shared/cl_debug.h"
 
 void
 textDestroy(text *t_head)
@@ -62,6 +63,20 @@
 	}
 }
 
+#ifdef CL_DEBUG
+int
+textTestDebug(text *t_head)
+{
+	while(t_head) {
+		void *p = NULL;
+		p = strdup(t_head->t_text);
+		free(p);
+		t_head = t_head->t_next;	
+	}
+	return 1;
+}
+#endif
+
 /*
  * Remove trailing spaces from the lines and trailing blank lines
  */
diff -urN --exclude=Makefile.in --exclude=aclocal.m4 --exclude=autom4* --exclude=*~ --exclude=configure --exclude=target.h --exclude=Makefile --exclude=*.o --exclude=.deps --exclude=clamav-config.h clamav-devel.jm-pl4b.allocfixes.0/shared/cl_debug.h clamav-devel.jm-pl5a/shared/cl_debug.h
--- clamav-devel.jm-pl4b.allocfixes.0/shared/cl_debug.h	Wed Dec 31 19:00:00 1969
+++ clamav-devel.jm-pl5a/shared/cl_debug.h	Wed May 19 08:44:14 2004
@@ -0,0 +1,13 @@
+#ifndef CL_DEBUG_H
+	#define CL_DEBUG_H
+#ifdef CL_DEBUG
+
+#undef NDEBUG /*assert() on */
+#include <mcheck.h>
+
+int textTestDebug(text * t_head);
+	
+
+
+#endif /* CL_DEBUG */
+#endif /* CL_DEBUG_H */
diff -ur --exclude=auto* --exclude=configure* clamav-devel.jm-pl4b/clamd/server-th.c clamav-devel.jm-pl4b.allocfixes/clamd/server-th.c
--- clamav-devel.jm-pl4b/clamd/server-th.c	Sun May 16 20:21:27 2004
+++ clamav-devel.jm-pl4b.allocfixes/clamd/server-th.c	Mon May 17 08:33:39 2004
@@ -366,6 +366,11 @@
     sigdelset(&sigset, SIGHUP);
     sigdelset(&sigset, SIGPIPE);
     sigdelset(&sigset, SIGUSR2);
+    sigdelset(&sigset, SIGTSTP);
+    sigdelset(&sigset, SIGBUS);
+    sigdelset(&sigset, SIGILL);
+    sigdelset(&sigset, SIGABRT);
+    sigdelset(&sigset, SIGQUIT);
     sigprocmask(SIG_SETMASK, &sigset, NULL);
  
     /* SIGINT, SIGTERM, SIGSEGV */

diff -ur --exclude=auto* --exclude=configure* clamav-devel.jm-pl4b/clamd/server-th.c clamav-devel.jm-pl4b.allocfixes/clamd/server-th.c
--- clamav-devel.jm-pl4b/libclamav/mbox.c	Sun May 16 20:21:27 2004
+++ clamav-devel.jm-pl4b.allocfixes/clamd/libclamav/mbox.c	Mon May 17 08:33:39 2004
@@ -214,7 +214,9 @@
 #endif
 
 #ifndef	CL_DEBUG
-/*#define	NDEBUG	/* map CLAMAV debug onto standard */
+  #define NDEBUG	/* map CLAMAV debug onto standard */
+#else
+  #undef NDEBUG
 #endif
 
