Index: /trunk/Ohana/src/opihi/cmd.basic/quit.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/quit.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.basic/quit.c	(revision 3922)
@@ -5,4 +5,5 @@
   int state;
 
+  print_ncals ();
   cleanup ();
 
@@ -12,5 +13,4 @@
   } 
 
-  ohana_memdump (0);
   exit (state);
 
Index: /trunk/Ohana/src/opihi/cmd.basic/run_if.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/run_if.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.basic/run_if.c	(revision 3922)
@@ -32,4 +32,5 @@
   if (val == NULL) return (FALSE);
   logic = atof (val); /* warning: round-off error is a danger */ 
+  free (val);
 
   if (BreakOnTrue) {
Index: /trunk/Ohana/src/opihi/cmd.basic/run_while.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.basic/run_while.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.basic/run_while.c	(revision 3922)
@@ -18,4 +18,5 @@
   if (val == NULL) return (FALSE);
   logic = atof (val); /* warning: round-off error is a danger */
+  free (val);
   
   NLINES = D_NLINES;
@@ -85,4 +86,5 @@
     if (val == NULL) return (FALSE);
     logic = atof (val); /* warning: round-off error is a danger */
+    free (val);
   } while (logic && !interrupt);
   loop_continue = loop_break = FALSE;
Index: /trunk/Ohana/src/opihi/cmd.data/select.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/select.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.data/select.c	(revision 3922)
@@ -35,4 +35,5 @@
   
   DeleteVector (tvec);
+  free (out);
   return (TRUE);
 
@@ -41,4 +42,5 @@
   DeleteVector (ovec);
   DeleteNamedVector (out);
+  free (out);
   return (FALSE);
 }
Index: /trunk/Ohana/src/opihi/cmd.data/set.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/set.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.data/set.c	(revision 3922)
@@ -21,4 +21,5 @@
     case 0:
       set_str_variable (argv[1], out);
+      free (out);
       break;
 
@@ -26,7 +27,9 @@
       if (!MoveNamedVector (argv[1], out)) {
 	DeleteNamedVector (out);
+	free (out);
 	fprintf (stderr, "invalid output vector name\n");
 	return (FALSE);
       }
+      free (out);
       break;
   
@@ -34,7 +37,9 @@
       if (!MoveNamedBuffer (argv[1], out)) {
 	DeleteNamedBuffer (out);
+	free (out);
 	fprintf (stderr, "invalid output matrix name\n");
 	return (FALSE);
       }
+      free (out);
       break;
   }
Index: /trunk/Ohana/src/opihi/cmd.data/subset.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/subset.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/cmd.data/subset.c	(revision 3922)
@@ -39,4 +39,5 @@
 
   DeleteVector (tvec);
+  free (out);
   return (TRUE);
 
@@ -45,4 +46,5 @@
   DeleteVector (ovec);
   DeleteNamedVector (out);
+  free (out);
   return (FALSE);
 }
Index: /trunk/Ohana/src/opihi/lib.shell/ListOps.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/ListOps.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/lib.shell/ListOps.c	(revision 3922)
@@ -39,38 +39,31 @@
 int is_for_loop (char *line) {
 
+  int status;
   char *comm;
 
   comm = thisword (line);
   if (comm == (char *) NULL) return (FALSE);
-
-  if (strcmp (comm, "for")) {
-    free (comm);
-    return (FALSE);
-  }
-
-  return (TRUE);
-
+  
+  status = !strcmp (comm, "for");
+  free (comm);
+  return (status);
 }
 
 int is_macro_create (char *line) {
 
-  int i, N;
+  int i, N, status;
   char *comm;
   char *this_macro;
 
+  comm = thisword (line);
+  if (comm == (char *) NULL) return (FALSE);
 
-  comm = thisword (line);
-  if (comm == (char *) NULL)
-    return (FALSE);
-  if (strcmp (comm, "macro")) {
-    free (comm);
-    return (FALSE);
-  }
+  status = !strcmp (comm, "macro");
+  free (comm);
+  if (!status) return (FALSE);
   
   this_macro = thisword (nextword (line));
 
-  if (this_macro == (char *)NULL) {
-    return (FALSE);
-  }
+  if (this_macro == (char *)NULL) return (FALSE);
 
   N = sizeof (in_macro) / sizeof (Command);
@@ -101,7 +94,9 @@
   if (strcmp (comm, "if")) goto escape;
 
+  /* if (cond) break does not define a complete block */
   if ((temp != NULL) && !strcmp (temp, "break")) goto escape;
 
-  free (comm);
+  if (temp != NULL) free (temp);
+  if (comm != NULL) free (comm);
   return (TRUE);
 
@@ -114,4 +109,5 @@
 int is_loop (char *line) {
 
+  int status;
   char *comm;
 
@@ -119,10 +115,7 @@
   if (comm == (char *) NULL) return (FALSE);
 
-  if (strcmp (comm, "while")) {
-    free (comm);
-    return (FALSE);
-  }
+  status = !strcmp (comm, "while");
   free (comm);
-  return (TRUE);
+  return (status);
 }
 
Index: /trunk/Ohana/src/opihi/lib.shell/expand_vars.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/expand_vars.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/lib.shell/expand_vars.c	(revision 3922)
@@ -44,4 +44,5 @@
       if ((*V1 == '=') || !strcmp (V1, "++") || !strcmp (V1, "--")) {
 	*N = *L;
+	free (V0);
 	continue;
       }
Index: /trunk/Ohana/src/opihi/lib.shell/expand_vectors.c
===================================================================
--- /trunk/Ohana/src/opihi/lib.shell/expand_vectors.c	(revision 3921)
+++ /trunk/Ohana/src/opihi/lib.shell/expand_vectors.c	(revision 3922)
@@ -19,4 +19,5 @@
   if (L == NULL) {
     free (newline);
+    free (tmpline);
     return (line);
   }
@@ -45,4 +46,7 @@
       if (val == NULL) goto dumpline; /* not a valid vector subscript */
     }
+    I = atoi (val);
+    free (val);
+
     /* find vector name */
     for (w = p - 1; (w >= line) && !whitespace(*w) && (isalnum(*w) || (*w == ':') || (*w == '_')); w--);
@@ -51,11 +55,7 @@
     strncpy (tmpline, w, n);
     tmpline[n] = 0;
-    if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) {
-      free (val);
-      goto dumpline;
-    }
+    if ((vec = SelectVector (tmpline, OLDVECTOR, TRUE)) == NULL) goto dumpline;
+
     /* find vector element */
-    I = atoi (val);
-    free (val);
     if (I >= vec[0].Nelements) {
       fprintf (stderr, "vector subscript out of range\n"); 
