Index: trunk/ippTools/src/stacktool.c
===================================================================
--- trunk/ippTools/src/stacktool.c	(revision 26984)
+++ trunk/ippTools/src/stacktool.c	(revision 26989)
@@ -158,4 +158,12 @@
     // these are used to build the HAVING restriction
     PXOPT_COPY_S32(config->args, having, "-min_num", "num_warp", ">=");
+    PXOPT_LOOKUP_S32(min_num,     config->args, "-min_new",  false, false);
+    if (min_num < 2) {
+        psError(PXTOOLS_ERR_CONFIG, true, "Require at least two inputs for a stack, but min_num = %d",
+                min_num);
+        psFree(where);
+        psFree(having);
+        return false;
+    }
 
     // other options applied outside of the WHERE
@@ -168,6 +176,7 @@
 
     if (!psListLength(where->list)) {
+        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
         psFree(where);
-        psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required");
+        psFree(having);
         return false;
     }
@@ -176,4 +185,6 @@
     if (!select) {
         psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
+        psFree(where);
+        psFree(having);
         return false;
     }
