From a9729ecf01374b1422425f7fbc8e14f992a765ff Mon Sep 17 00:00:00 2001 From: miko Date: Fri, 26 Oct 2018 14:36:04 +0000 Subject: Fix memory leak in setDolp() where dp is NULL. Based on a diff from netbsd, with help from martijn@ and millert@. --- bin/csh/dol.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/csh/dol.c b/bin/csh/dol.c index 3f2d510bfa1..0f23b801ddb 100644 --- a/bin/csh/dol.c +++ b/bin/csh/dol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dol.c,v 1.24 2018/09/18 06:56:09 deraadt Exp $ */ +/* $OpenBSD: dol.c,v 1.25 2018/10/26 14:36:03 miko Exp $ */ /* $NetBSD: dol.c,v 1.8 1995/09/27 00:38:38 jtc Exp $ */ /*- @@ -762,12 +762,8 @@ setDolp(Char *cp) } } - if (dp) { - addla(dp); - free(dp); - } - else - addla(cp); + addla(cp); + free(cp); dolp = STRNULL; if (seterr) -- cgit v1.2.3