Free handle storage.
[miniexpect.git] / miniexpect.c
index fef03fd..7f02584 100644 (file)
@@ -80,6 +80,8 @@ mexp_close (mexp_h *h)
       return -1;
   }
 
+  free (h);
+
   return status;
 }
 
@@ -208,6 +210,10 @@ mexp_expect (mexp_h *h, const mexp_regexp *regexps, int *ovector, int ovecsize)
   time (&start_t);
 
   /* Clear the read buffer. */
+  /* XXX This is possibly incorrect because it throws away inputs that
+   * may not have been matched yet.  A better idea is to record the
+   * end of the previous match and only throw that away.
+   */
   clear_buffer (h);
 
   for (;;) {