From 05206ed429b296ea07b5312e1b3173c9953e3caa Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Thu, 2 Aug 2007 10:50:26 +0000 Subject: fix memory leaks and one potential null deref found by coverity. from netbsd. millert@ ok --- bin/ksh/c_sh.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'bin/ksh/c_sh.c') diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c index 89e0f30dbcf..716dc7c70af 100644 --- a/bin/ksh/c_sh.c +++ b/bin/ksh/c_sh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_sh.c,v 1.35 2006/04/10 14:38:59 jaredy Exp $ */ +/* $OpenBSD: c_sh.c,v 1.36 2007/08/02 10:50:25 fgsch Exp $ */ /* * built-in Bourne commands @@ -414,6 +414,7 @@ int c_eval(char **wp) { struct source *s; + int rv; if (ksh_getopt(wp, &builtin_opt, null) == '?') return 1; @@ -447,7 +448,9 @@ c_eval(char **wp) exstat = subst_exstat; } - return shell(s, false); + rv = shell(s, false); + afree(s, ATEMP); + return (rv); } int @@ -595,7 +598,8 @@ c_brkcont(char **wp) * shall be used. Doesn't say to print an error but we * do anyway 'cause the user messed up. */ - last_ep->flags &= ~EF_BRKCONT_PASS; + if (last_ep) + last_ep->flags &= ~EF_BRKCONT_PASS; warningf(true, "%s: can only %s %d level(s)", wp[0], wp[0], n - quit); } -- cgit v1.2.3