summaryrefslogtreecommitdiff
path: root/Src/params.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/params.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/params.c')
-rw-r--r--Src/params.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/params.c b/Src/params.c
index 6c07396b2..f4575b56e 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -704,7 +704,7 @@ createparam(char *name, int flags)
if (isset(ALLEXPORT) && !(flags & PM_HASHELEM))
flags |= PM_EXPORTED;
} else {
- pm = (Param) zhalloc(sizeof *pm);
+ pm = (Param) hcalloc(sizeof *pm);
pm->nam = nulstring;
}
pm->flags = flags & ~PM_LOCAL;
@@ -727,6 +727,7 @@ copyparam(Param tpm, Param pm, int toplevel)
* with sets.?fn() usage).
*/
tpm->flags = pm->flags;
+ tpm->ct = pm->ct;
if (!toplevel)
tpm->flags &= ~PM_SPECIAL;
switch (PM_TYPE(pm->flags)) {
@@ -2551,6 +2552,7 @@ usernamesetfn(Param pm, char *x)
}
}
#endif /* HAVE_SETUID && HAVE_GETPWNAM */
+ zsfree(x);
}
/* Function to get value for special parameter `UID' */