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/cc806b03ecac
branches:  trunk
changeset: 944013:cc806b03ecac
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 add099549d7d -r cc806b03ecac 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