Module Name:    src
Committed By:   rillig
Date:           Mon Nov 30 18:49:58 UTC 2020

Modified Files:
        src/usr.bin/make: dir.c

Log Message:
make(1): fix memory leak for lstat cache in -DCLEANUP mode


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/usr.bin/make/dir.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/dir.c
diff -u src/usr.bin/make/dir.c:1.242 src/usr.bin/make/dir.c:1.243
--- src/usr.bin/make/dir.c:1.242	Sun Nov 29 21:50:50 2020
+++ src/usr.bin/make/dir.c	Mon Nov 30 18:49:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.242 2020/11/29 21:50:50 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.243 2020/11/30 18:49:58 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -136,7 +136,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.242 2020/11/29 21:50:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.243 2020/11/30 18:49:58 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -226,15 +226,13 @@ struct CachedDir {
 	 * The number of SearchPaths that refer to this directory.
 	 * Plus the number of global variables that refer to this directory.
 	 * References from openDirs do not count though.
-	 *
-	 * TODO: Check the reference counting; see Dir_Expand, partPath.
 	 */
 	int refCount;
 
 	/* The number of times a file in this directory has been found. */
 	int hits;
 
-	/* The names of the files in the directory. */
+	/* The names of the directory entries. */
 	HashSet files;
 };
 
@@ -536,6 +534,7 @@ Dir_End(void)
 	SearchPath_Clear(&dirSearchPath);
 	OpenDirs_Done(&openDirs);
 	HashTable_Done(&mtimes);
+	HashTable_Done(&lmtimes);
 #endif
 }
 

Reply via email to