Index: trunk/ippTools/src/pztoolConfig.c
===================================================================
--- trunk/ippTools/src/pztoolConfig.c	(revision 11702)
+++ trunk/ippTools/src/pztoolConfig.c	(revision 11860)
@@ -27,6 +27,6 @@
 #include "pztool.h"
 
-// this function can not fail -- exits on error
-pxConfig *pztoolConfig(pxConfig *config, int argc, char **argv) {
+pxConfig *pztoolConfig(pxConfig *config, int argc, char **argv)
+{
     if (!config) {
         config = pxConfigAlloc();
@@ -39,5 +39,6 @@
     if (! config->modules) {
         psError(PS_ERR_UNKNOWN, false, "Can't find site configuration!\n");
-        exit(EXIT_FAILURE);
+        psFree(config);
+        return NULL;
     }
 
@@ -103,5 +104,6 @@
         if (config->mode) { \
             psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); \
-            goto FAIL; \
+            psFree(config); \
+            return NULL; \
         } \
         config->mode = modeval; \
@@ -148,5 +150,6 @@
 
         psFree(argSets);
-        goto FAIL;
+        psFree(config);
+        return NULL;
     }
 
@@ -161,5 +164,6 @@
         if (!psMetadataAddStr(config->where, PS_LIST_TAIL, #name, 0, "==", str)) {\
             psError(PS_ERR_UNKNOWN, false, "failed to add item " #name); \
-            goto FAIL; \
+            psFree(config); \
+            return NULL; \
         } \
     } \
@@ -178,5 +182,6 @@
             if (!psMetadataAddStr(config->where, PS_LIST_TAIL, "camera", 0, "==", str)) {
                 psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
-                goto FAIL;
+                psFree(config);
+                return NULL;
             }
         }
@@ -197,5 +202,6 @@
     if (!config->dbh) {
         psError(PS_ERR_UNKNOWN, false, "Can't configure database");
-        goto FAIL;
+        psFree(config);
+        return NULL;
     }
 
@@ -205,9 +211,3 @@
 
     return config;
-
-FAIL:
-    psFree(config);
-    pmConfigDone();
-    psLibFinalize();
-    exit(EXIT_FAILURE);
 }
