Module Name:    src
Committed By:   rillig
Date:           Thu Sep 23 22:54:09 UTC 2021

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

Log Message:
make: fix memory leak in error case of the ':?' modifier


To generate a diff of this commit:
cvs rdiff -u -r1.951 -r1.952 src/usr.bin/make/var.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/var.c
diff -u src/usr.bin/make/var.c:1.951 src/usr.bin/make/var.c:1.952
--- src/usr.bin/make/var.c:1.951	Tue Sep 21 23:06:18 2021
+++ src/usr.bin/make/var.c	Thu Sep 23 22:54:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.951 2021/09/21 23:06:18 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.952 2021/09/23 22:54:09 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.951 2021/09/21 23:06:18 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.952 2021/09/23 22:54:09 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3444,6 +3444,8 @@ ApplyModifier_IfElse(const char **pp, Mo
 	if (cond_rc == COND_INVALID) {
 		Error("Bad conditional expression '%s' in '%s?%s:%s'",
 		    expr->name, expr->name, then_expr.str, else_expr.str);
+		FStr_Done(&then_expr);
+		FStr_Done(&else_expr);
 		return AMR_CLEANUP;
 	}
 

Reply via email to