about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-02 08:09:26 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-02 08:09:26 +0000
commited708a901be74fe49c6357db0b10f5bf451edadf (patch)
tree79a6e56037068b04fe2d9fd0d89348e09354e526 /Src
parent040aca2023a0f6d09498b6469ca1bd16b7bc0068 (diff)
downloadzsh-ed708a901be74fe49c6357db0b10f5bf451edadf.tar.gz
zsh-ed708a901be74fe49c6357db0b10f5bf451edadf.tar.xz
zsh-ed708a901be74fe49c6357db0b10f5bf451edadf.zip
fix some memory leaks (thanks, Felix) (11722)
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c1
-rw-r--r--Src/Zle/complete.c10
2 files changed, 7 insertions, 4 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index ded5c3b31..df7e67e59 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -2879,6 +2879,7 @@ freematches(Cmgroup g)
 
 	for (m = g->matches; *m; m++)
 	    freematch(*m, g->nbrbeg, g->nbrend);
+	free(g->matches);
 
 	if (g->ylist)
 	    freearray(g->ylist);
diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 6054f2ac1..1a659f781 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -291,7 +291,7 @@ parse_cmatcher(char *name, char *s)
 	if (err)
 	    return pcm_err;
 
-	n = (Cmatcher) zcalloc(sizeof(*ret));
+	n = (Cmatcher) hcalloc(sizeof(*ret));
 	n->next = NULL;
 	n->flags = fl;
 	n->line = line;
@@ -568,9 +568,11 @@ bin_compadd(char *name, char **argv, char *ops, int func)
 		    return 1;
 		}
 		if (dm) {
-		    if (mstr)
-			mstr = tricat(mstr, " ", m);
-		    else
+		    if (mstr) {
+			char *tmp = tricat(mstr, " ", m);
+			zsfree(mstr);
+			mstr = tmp;
+		    } else
 			mstr = ztrdup(m);
 		    m = NULL;
 		}