From f61037a0b04616f40f5c849a5f590232f3cff235 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 6 Apr 2014 09:55:49 -0700 Subject: 32531: fix memory leaks detected by valgrind --- Src/Zle/zle_refresh.c | 3 +++ Src/Zle/zle_tricky.c | 1 + Src/hist.c | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Src') 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 -- cgit 1.4.1