Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): in debug mode, reset unused stack spac...



details:   https://anonhg.NetBSD.org/src/rev/b7613b5cf8c8
branches:  trunk
changeset: 955001:b7613b5cf8c8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Sep 14 19:14:19 2020 +0000

description:
make(1): in debug mode, reset unused stack space to NULL

diffstat:

 usr.bin/make/lst.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r c6fc158f7ee3 -r b7613b5cf8c8 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Mon Sep 14 19:00:28 2020 +0000
+++ b/usr.bin/make/lst.c        Mon Sep 14 19:14:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.63 2020/09/13 15:15:51 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.64 2020/09/14 19:14:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -36,7 +36,7 @@
 
 #include "make.h"
 
-MAKE_RCSID("$NetBSD: lst.c,v 1.63 2020/09/13 15:15:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: lst.c,v 1.64 2020/09/14 19:14:19 rillig Exp $");
 
 struct ListNode {
     struct ListNode *prev;     /* previous element in list */
@@ -651,9 +651,15 @@
 
 void *Stack_Pop(Stack *stack)
 {
+    void *datum;
+
     assert(stack->len > 0);
     stack->len--;
-    return stack->items[stack->len];
+    datum = stack->items[stack->len];
+#ifdef CLEANUP
+    stack->items[stack->len] = NULL;
+#endif
+    return datum;
 }
 
 void Stack_Done(Stack *stack)



Home | Main Index | Thread Index | Old Index