Module Name:    src
Committed By:   rillig
Date:           Sun Dec 20 11:38:51 UTC 2020

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

Log Message:
make(1): document memory handling in ApplyModifiers


To generate a diff of this commit:
cvs rdiff -u -r1.740 -r1.741 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.740 src/usr.bin/make/var.c:1.741
--- src/usr.bin/make/var.c:1.740	Sun Dec 20 10:59:21 2020
+++ src/usr.bin/make/var.c	Sun Dec 20 11:38:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.740 2020/12/20 10:59:21 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.741 2020/12/20 11:38:51 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.740 2020/12/20 10:59:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.741 2020/12/20 11:38:51 rillig Exp $");
 
 /* A string that may need to be freed after use. */
 typedef struct FStr {
@@ -3596,7 +3596,8 @@ ApplyModifiers(
 
 		if (st.newVal != st.val) {
 			if (*inout_freeIt != NULL) {
-				free(st.val);
+				assert(*inout_freeIt == st.val);
+				free(*inout_freeIt);
 				*inout_freeIt = NULL;
 			}
 			st.val = st.newVal;

Reply via email to