Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint2 lint: fix memory leak in symtab_forall_s...



details:   https://anonhg.NetBSD.org/src/rev/4ff318d738ca
branches:  trunk
changeset: 1023182:4ff318d738ca
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 28 19:00:55 2021 +0000

description:
lint: fix memory leak in symtab_forall_sorted (since today)

diffstat:

 usr.bin/xlint/lint2/hash.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r 935aa118ee7c -r 4ff318d738ca usr.bin/xlint/lint2/hash.c
--- a/usr.bin/xlint/lint2/hash.c        Sat Aug 28 18:58:24 2021 +0000
+++ b/usr.bin/xlint/lint2/hash.c        Sat Aug 28 19:00:55 2021 +0000
@@ -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 @@
        }
 }
 
-
 /* 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 @@
 
        for (i = 0; i < sorted.len; i++)
                action(sorted.items[i]);
+
+       free(sorted.items);
 }
 
 /*



Home | Main Index | Thread Index | Old Index