Index: trunk/src/samhain.c
===================================================================
--- trunk/src/samhain.c	(revision 578)
+++ trunk/src/samhain.c	(revision 579)
@@ -777,4 +777,5 @@
   sh_hash_hashdelete();
   sh_files_hle_reg (NULL);
+  (void) sh_ignore_clean ();
   /*
    * Only flush on exit if running as deamon.
Index: trunk/src/sh_dbIO.c
===================================================================
--- trunk/src/sh_dbIO.c	(revision 578)
+++ trunk/src/sh_dbIO.c	(revision 579)
@@ -1415,4 +1415,5 @@
     lpath = ll;
   else
+    /* cppcheck-suppress uninitvar */
     lpath = linkpath;
 
Index: trunk/src/sh_files.c
===================================================================
--- trunk/src/sh_files.c	(revision 578)
+++ trunk/src/sh_files.c	(revision 579)
@@ -2315,4 +2315,7 @@
 	    { 
 	      ++theDir->NumDirs;
+#if defined(SH_USE_SCANDIR)
+	      free(entryList[entry]); /* scandir() mallocs entries */
+#endif
 	      continue;
 	    }
@@ -2320,4 +2323,7 @@
 	    {
 	      ++theDir->NumDirs;
+#if defined(SH_USE_SCANDIR)
+	      free(entryList[entry]); /* scandir() mallocs entries */
+#endif
 	      continue;
 	    }
Index: trunk/src/sh_mem.c
===================================================================
--- trunk/src/sh_mem.c	(revision 578)
+++ trunk/src/sh_mem.c	(revision 579)
@@ -77,5 +77,6 @@
 #endif
 
-/* define MEM_LOG to an absolute filename to enable this */
+/* define MEM_LOG to enable this */
+/* #define MEM_LOG 1 */
 #ifdef MEM_LOG
 void sh_mem_dump ()
@@ -83,12 +84,16 @@
   memlist_t   * this = memlist;
   FILE * fd;
-
+  static unsigned int nr = 0;
+  char filename[256];
+
+  snprintf(filename, sizeof(filename), "sh_mem_dump.%04u.%lu", nr, (unsigned long) sh.pid);
+  
   SH_MUTEX_RECURSIVE_INIT(mutex_mem);
   SH_MUTEX_RECURSIVE_LOCK(mutex_mem);
 
-  fd = fopen(MEM_LOG, "w");
+  fd = fopen(filename, "w");
   if (!fd)
     {
-      perror(MEM_LOG);
+      perror(filename);
       _exit(EXIT_FAILURE);
     }
@@ -103,5 +108,7 @@
 
   SH_MUTEX_RECURSIVE_UNLOCK(mutex_mem);
-  _exit(EXIT_SUCCESS);
+  ++nr;
+  /* _exit(EXIT_SUCCESS); */
+  return;
 }
 #else
Index: trunk/src/sh_sig.c
===================================================================
--- trunk/src/sh_sig.c	(revision 578)
+++ trunk/src/sh_sig.c	(revision 579)
@@ -1695,4 +1695,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_check_signature (file, what);
+#else
+  return -1;
 #endif
 }
@@ -1704,4 +1706,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_extract_signed(fd, SIG_DATASIG);
+#else
+  return -1;
 #endif
 }
@@ -1713,4 +1717,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_extract_signed(fd, SIG_DATAONLY);
+#else
+  return -1;
 #endif
 }
@@ -1722,4 +1728,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_msg_start(line);
+#else
+  return -1;
 #endif
 }
@@ -1731,4 +1739,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_msg_startdata(line);
+#else
+  return -1;
 #endif
 }
@@ -1740,4 +1750,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_msg_end(line);
+#else
+  return -1;
 #endif
 }
@@ -1749,4 +1761,6 @@
 #elif defined(WITH_SIGNIFY)
   return sh_signify_data_end(line);
+#else
+  return -1;
 #endif
 }
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 578)
+++ trunk/src/sh_unix.c	(revision 579)
@@ -3603,6 +3603,8 @@
 	      }
 	    }
-	  SH_FREE(rotated_file);
-	}
+	}
+      if (rotated_file) {
+	SH_FREE(rotated_file);
+      }
     }
   return retval;
@@ -4872,6 +4874,6 @@
   if (0 == retry_lstat(FIL__, __LINE__, path, &buf))
     SL_RETURN( S_TRUE,   _("sh_unix_file_exists"));
-  else 
-    SL_RETURN( S_FALSE,  _("sh_unix_file_exists"));
+
+  SL_RETURN( S_FALSE,  _("sh_unix_file_exists"));
 }
 
@@ -4888,8 +4890,8 @@
   if (retry_fstat(FIL__, __LINE__, fd, &buf) == -1)
     SL_RETURN( (-1), _("sh_unix_device_readable"));
-  else if ( S_ISCHR(buf.st_mode) &&  0 != (S_IROTH & buf.st_mode) ) 
+  if ( S_ISCHR(buf.st_mode) &&  0 != (S_IROTH & buf.st_mode) ) 
     SL_RETURN( (0), _("sh_unix_device_readable"));
-  else 
-    SL_RETURN( (-1), _("sh_unix_device_readable"));
+
+  SL_RETURN( (-1), _("sh_unix_device_readable"));
 }
 
