Module Name:    src
Committed By:   rillig
Date:           Sat Aug 28 19:00:55 UTC 2021

Modified Files:
        src/usr.bin/xlint/lint2: hash.c

Log Message:
lint: fix memory leak in symtab_forall_sorted (since today)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/xlint/lint2/hash.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/xlint/lint2/hash.c
diff -u src/usr.bin/xlint/lint2/hash.c:1.19 src/usr.bin/xlint/lint2/hash.c:1.20
--- src/usr.bin/xlint/lint2/hash.c:1.19	Sat Aug 28 17:18:42 2021
+++ src/usr.bin/xlint/lint2/hash.c	Sat Aug 28 19:00:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: hash.c,v 1.19 2021/08/28 17:18:42 rillig Exp $");
+__RCSID("$NetBSD: hash.c,v 1.20 2021/08/28 19:00:55 rillig Exp $");
 #endif
 
 /*
@@ -169,7 +169,6 @@ symtab_forall(void (*action)(hte_t *))
 	}
 }
 
-
 /* Run the action for each name in the symbol table, in alphabetic order. */
 void
 symtab_forall_sorted(void (*action)(hte_t *))
@@ -187,6 +186,8 @@ symtab_forall_sorted(void (*action)(hte_
 
 	for (i = 0; i < sorted.len; i++)
 		action(sorted.items[i]);
+
+	free(sorted.items);
 }
 
 /*

Reply via email to