summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-07-22 17:56:51 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-07-22 17:56:51 +0000
commit6fb5eeac56c68b1fe0e9a10fc1f83dc50b021e53 (patch)
treef5f834fd23855838734b305af884d12229c03d9b /usr.bin/make
parent7aaa9b693ab4f4466af3f2dadcaa25ce4de4debf (diff)
make sure loop variables use their own buffers.
(causes .for loops to give weird results very infrequently, memory handling was slightly wrong, but not enough to break things thoroughly). noticed by naddy@
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/var.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/make/var.c b/usr.bin/make/var.c
index f3215765446..559f82d5076 100644
--- a/usr.bin/make/var.c
+++ b/usr.bin/make/var.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: var.c,v 1.66 2007/07/20 12:32:45 espie Exp $ */
+/* $OpenBSD: var.c,v 1.67 2007/07/22 17:56:50 espie Exp $ */
/* $NetBSD: var.c,v 1.18 1997/03/18 19:24:46 christos Exp $ */
/*
@@ -1094,13 +1094,15 @@ Var_NewLoopVar(const char *name, const char *ename)
l->me = find_global_var_without_env(name, ename, k);
l->old = *(l->me);
- l->me->flags |= VAR_SEEN_ENV;
+ l->me->flags = VAR_SEEN_ENV | VAR_DUMMY;
return l;
}
void
Var_DeleteLoopVar(struct LoopVar *l)
{
+ if ((l->me->flags & VAR_DUMMY) == 0)
+ Buf_Destroy(&(l->me->val));
*(l->me) = l->old;
free(l);
}