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): fix assertion failure in Dir_Destroy i...



details:   https://anonhg.NetBSD.org/src/rev/9ed0bc249d36
branches:  trunk
changeset: 943898:9ed0bc249d36
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 12 23:12:44 2020 +0000

description:
make(1): fix assertion failure in Dir_Destroy in -DCLEANUP mode

When the openDirectories path list is cleaned up, each path from it is
first dequeued and then freed via Dir_Destroy.  At this point, the path
is no longer in openDirectories, which triggered an assertion in
Lst_Remove, called by Dir_Destroy.

diffstat:

 usr.bin/make/dir.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (41 lines):

diff -r 923a276448e7 -r 9ed0bc249d36 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sat Sep 12 23:04:44 2020 +0000
+++ b/usr.bin/make/dir.c        Sat Sep 12 23:12:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
 #else
-__RCSID("$NetBSD: dir.c,v 1.140 2020/09/12 12:24:21 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1656,10 +1656,11 @@
     p->refCount -= 1;
 
     if (p->refCount == 0) {
-       LstNode ln;
+       LstNode node;
 
-       ln = Lst_FindDatum(openDirectories, p);
-       Lst_Remove(openDirectories, ln);
+       node = Lst_FindDatum(openDirectories, p);
+       if (node != NULL)
+           Lst_Remove(openDirectories, node);
 
        Hash_DeleteTable(&p->files);
        free(p->name);



Home | Main Index | Thread Index | Old Index