summaryrefslogtreecommitdiff
path: root/Src/Zle/computil.c
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-31 09:43:59 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-05-31 09:43:59 +0000
commit1b2d095217d1560a648032aa192057b935ce9460 (patch)
tree4126aa0dc04cde27de4cc3fe83de835190f34e71 /Src/Zle/computil.c
parentae5e34db253ffd89369dd67835999c23dd9e62c2 (diff)
downloadzsh-1b2d095217d1560a648032aa192057b935ce9460.tar.gz
zsh-1b2d095217d1560a648032aa192057b935ce9460.zip
fix two memory leaks (at least I hope they are fixed) and some out-of-bound array accesses, plus some defensive programming for heap allocated param structs (14605)
Diffstat (limited to 'Src/Zle/computil.c')
-rw-r--r--Src/Zle/computil.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index d7d44f999..2c0e119f9 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -819,8 +819,9 @@ parse_cadef(char *nam, char **args)
if (!multi) {
if (!xor) {
xor = (char **) zalloc(2 * sizeof(char *));
- xor[1] = NULL;
+ xor[0] = xor[1] = NULL;
}
+ zsfree(xor[xnum]);
xor[xnum] = ztrdup(rembslashcolon(name));
}
if (c == ':') {
@@ -1029,7 +1030,7 @@ get_cadef(char *nam, char **args)
Cadef *p, *min, new;
int i, na = arrlen(args);
- for (i = MAX_CACACHE, p = cadef_cache, min = NULL; *p && i; p++, i--)
+ for (i = MAX_CACACHE, p = cadef_cache, min = NULL; i && *p; p++, i--)
if (*p && na == (*p)->ndefs && arrcmp(args, (*p)->defs)) {
(*p)->lastt = time(0);