Module Name: src
Committed By: kre
Date: Sat Jun 17 04:19:12 UTC 2017
Modified Files:
src/bin/sh: cd.c
Log Message:
Free stack memory in a couple of obscure cases where it wasn't
being done (one in probably dead code that is never compiled, the other
in a very rare error case.) Since it is stack memory it wasn't lost
in any case, just held longer than needed.
To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/bin/sh/cd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/bin/sh/cd.c
diff -u src/bin/sh/cd.c:1.48 src/bin/sh/cd.c:1.49
--- src/bin/sh/cd.c:1.48 Sun Jun 4 20:27:14 2017
+++ src/bin/sh/cd.c Sat Jun 17 04:19:12 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cd.c,v 1.48 2017/06/04 20:27:14 kre Exp $ */
+/* $NetBSD: cd.c,v 1.49 2017/06/17 04:19:12 kre Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)cd.c 8.2 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: cd.c,v 1.48 2017/06/04 20:27:14 kre Exp $");
+__RCSID("$NetBSD: cd.c,v 1.49 2017/06/17 04:19:12 kre Exp $");
#endif
#endif /* not lint */
@@ -405,6 +405,7 @@ find_curdir(int noerror)
pwd = stalloc(i);
if (getcwd(pwd, i) != NULL) {
curdir = savestr(pwd);
+ stunalloc(pwd);
return;
}
stunalloc(pwd);
@@ -455,6 +456,7 @@ find_curdir(int noerror)
p[-1] = '\0';
INTON;
curdir = savestr(pwd);
+ stunalloc(pwd);
return;
}
#endif