about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/Zle/zle_refresh.c3
-rw-r--r--Src/Zle/zle_tricky.c1
-rw-r--r--Src/hist.c3
4 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a9088ed29..5dda3c932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-04-06  Barton E. Schaefer  <schaefer@brasslantern.com>
+
+	* 32531: Src/Zle/zle_refresh.c, Src/Zle/zle_tricky.c, Src/hist.c:
+	fix memory leaks detected by valgrind, two in ZLE region highlight
+	and one in :A history modifier.
+
 2014-04-06  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* Sebastian Ramacher: 32533: Completion/Debian/Command/_apt: add
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 8ce678756..80be27f03 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -444,6 +444,7 @@ void
 set_region_highlight(UNUSED(Param pm), char **aval)
 {
     int len;
+    char **av = aval;
     struct region_highlight *rhp;
 
     len = aval ? arrlen(aval) : 0;
@@ -490,6 +491,8 @@ set_region_highlight(UNUSED(Param pm), char **aval)
 
 	match_highlight(strp, &rhp->atr);
     }
+
+    freearray(av);
 }
 
 
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index 3c7cff9c1..b916bd653 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -2795,6 +2795,7 @@ doexpandhist(void)
     if (!err) {
 	zlemetacs = excs;
 	if (strcmp(zlemetaline, ol)) {
+	    zle_restore_positions();
 	    unmetafy_line();
 	    /* For vi mode -- reset the beginning-of-insertion pointer   *
 	     * to the beginning of the line.  This seems a little silly, *
diff --git a/Src/hist.c b/Src/hist.c
index 1845bd8ad..16249125b 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -1764,7 +1764,8 @@ chrealpath(char **junkptr)
 	str++;
     }
 
-    *junkptr = metafy(bicat(real, nonreal), -1, META_HEAPDUP);
+    *junkptr = metafy(str = bicat(real, nonreal), -1, META_HEAPDUP);
+    zsfree(str);
 #ifdef HAVE_CANONICALIZE_FILE_NAME
     free(real);
 #endif