Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Free stack memory in a couple of obscure cases where ...



details:   https://anonhg.NetBSD.org/src/rev/62a39a7d9e1c
branches:  trunk
changeset: 354450:62a39a7d9e1c
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Jun 17 04:19:12 2017 +0000

description:
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.

diffstat:

 bin/sh/cd.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r d3ae8c50f173 -r 62a39a7d9e1c bin/sh/cd.c
--- a/bin/sh/cd.c       Sat Jun 17 04:16:33 2017 +0000
+++ b/bin/sh/cd.c       Sat Jun 17 04:19:12 2017 +0000
@@ -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 @@
                pwd = stalloc(i);
                if (getcwd(pwd, i) != NULL) {
                        curdir = savestr(pwd);
+                       stunalloc(pwd);
                        return;
                }
                stunalloc(pwd);
@@ -455,6 +456,7 @@
                p[-1] = '\0';
                INTON;
                curdir = savestr(pwd);
+               stunalloc(pwd);
                return;
        }
 #endif



Home | Main Index | Thread Index | Old Index