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: fix memory leak when parsing a variable name
details: https://anonhg.NetBSD.org/src/rev/591604dd12c7
branches: trunk
changeset: 1027618:591604dd12c7
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Dec 13 04:18:01 2021 +0000
description:
make: fix memory leak when parsing a variable name
To trigger the memory leak, the expanded variable name must not be a
prefix of the textual variable name.
textual name expanded name
ok: UNDEF.${undef} UNDEF.
leak: UNDEF.${undef}. UNDEF..
diffstat:
usr.bin/make/var.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r 99b3042faaa2 -r 591604dd12c7 usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Dec 13 03:55:16 2021 +0000
+++ b/usr.bin/make/var.c Mon Dec 13 04:18:01 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.985 2021/12/13 03:55:16 rillig Exp $ */
+/* $NetBSD: var.c,v 1.986 2021/12/13 04:18:01 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.985 2021/12/13 03:55:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.986 2021/12/13 04:18:01 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -4433,6 +4433,7 @@
*out_false_pp = p;
*out_false_res = EvalUndefined(dynamic, start, p,
name, emode, out_false_val);
+ LazyBuf_Done(&varname);
return false;
}
Home |
Main Index |
Thread Index |
Old Index