From 1b2d095217d1560a648032aa192057b935ce9460 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Thu, 31 May 2001 09:43:59 +0000 Subject: 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) --- Src/params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Src/params.c') 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' */ -- cgit v1.2.3