Index: /trunk/ippTools/src/magictool.c
===================================================================
--- /trunk/ippTools/src/magictool.c	(revision 31096)
+++ /trunk/ippTools/src/magictool.c	(revision 31097)
@@ -873,5 +873,4 @@
         return false;
     }
-    psFree(whereString);
     psFree(query);
 
@@ -915,13 +914,13 @@
             }
 
-            whereString = NULL;
-            psStringAppend(&whereString, "\nAND (magic_id = %" PRId64 ")", magic_id);
-            if (!p_psDBRunQueryF(config->dbh, query, whereString )) {
+            psString whereString2 = NULL;
+            psStringAppend(&whereString2, "\nAND (magic_id = %" PRId64 ")", magic_id);
+            if (!p_psDBRunQueryF(config->dbh, query, whereString2 )) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
-                psFree(whereString);
+                psFree(whereString2);
                 psFree(query);
                 return false;
             }
-            psFree(whereString);
+            psFree(whereString2);
             psArray *magicTree = p_psDBFetchResult(config->dbh);
             if (!magicTree) {
@@ -1022,4 +1021,5 @@
         return false;
     }
+    psFree(whereString);
     psFree(query);
 
