Imported Upstream version 1.12.0
[platform/upstream/augeas.git] / src / jmt.c
index 9b0b38e..86179ee 100644 (file)
--- a/src/jmt.c
+++ b/src/jmt.c
@@ -1,7 +1,7 @@
 /*
  * jmt.c: Earley parser for lenses based on Jim/Mandelbaum transducers
  *
- * Copyright (C) 2009-2015 David Lutterkort
+ * Copyright (C) 2009-2016 David Lutterkort
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1109,16 +1109,20 @@ static ind_t add_lens(struct jmt *jmt, struct lens *lens) {
 
     if (debugging("cf.jmt")) {
         if (sA == NULL) {
+            char *s = format_lens(lens);
             printf("add_lens: ");
             print_regexp(stdout, lens->ctype);
-            printf(" %s\n", format_lens(lens));
+            printf(" %s\n", s);
+            free(s);
         } else {
+            char *s = format_lens(lens);
             printf("add_lens: ");
             flens(stdout, l);
-            printf(" %u %s\n", sA->num, format_lens(lens));
+            printf(" %u %s\n", sA->num, s);
             if (nullable) {
-                printf("add_lens: // %s\n", format_lens(lens));
+                printf("add_lens: // %s\n", s);
             }
+            free(s);
         }
     }