summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authormiko <miko@cvs.openbsd.org>2018-10-26 14:36:04 +0000
committermiko <miko@cvs.openbsd.org>2018-10-26 14:36:04 +0000
commita9729ecf01374b1422425f7fbc8e14f992a765ff (patch)
tree5c4e8823d914278558dddcdf3a7713557f808844 /bin
parent92f4974ece21c8250c58d4d862a8f12d8b751abe (diff)
Fix memory leak in setDolp() where dp is NULL. Based on a diff from
netbsd, with help from martijn@ and millert@.
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/dol.c10
1 files changed, 3 insertions, 7 deletions
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)