summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorsjg <sjg@NetBSD.org>2006-07-28 17:06:14 +0000
committersjg <sjg@NetBSD.org>2006-07-28 17:06:14 +0000
commit772ecb66aa5f92f2ea45212a5bf752a6ce04a1af (patch)
treeb7ddbcf99938b0f6200648db18e530f95680b796 /usr.bin/make
parentbce72f7b6a45ba2ebfe2b93c2e1d56b753df3987 (diff)
Fix minor mem leak in PrintOnError().
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/main.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 834f2e20c58..e007c0f01ae 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.127 2006/06/29 22:02:06 rillig Exp $ */
+/* $NetBSD: main.c,v 1.128 2006/07/28 17:06:14 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.127 2006/06/29 22:02:06 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.128 2006/07/28 17:06:14 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.127 2006/06/29 22:02:06 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.128 2006/07/28 17:06:14 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -1726,16 +1726,20 @@ void
PrintOnError(const char *s)
{
char tmp[64];
-
+ char *cp;
+
if (s)
printf("%s", s);
printf("\n%s: stopped in %s\n", progname, curdir);
strncpy(tmp, "${MAKE_PRINT_VAR_ON_ERROR:@v@$v='${$v}'\n@}",
sizeof(tmp) - 1);
- s = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
- if (s && *s)
- printf("%s", s);
+ cp = Var_Subst(NULL, tmp, VAR_GLOBAL, 0);
+ if (cp) {
+ if (*cp)
+ printf("%s", cp);
+ free(cp);
+ }
}
void