From f701e1c32043116448e7227ee598b21e00ce42c7 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Wed, 20 Mar 2013 23:42:00 +1100 Subject: [PATCH] cmd/6c, cmd/8c: fix stack allocated Biobuf leaking at exit Fixes #5085. {6,8}c/swt.c allocates a third Biobuf in automatic memory which is not terminated at the end of the function. This causes the buffer to be 'in use' when the batexit handler fires, confusing valgrind. Huge thanks to DMorsing for the diagnosis. R=golang-dev, daniel.morsing, rsc CC=golang-dev https://golang.org/cl/7844044 --- src/cmd/6c/swt.c | 2 +- src/cmd/8c/swt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/6c/swt.c b/src/cmd/6c/swt.c index 58d6d51291..541c7beaaa 100644 --- a/src/cmd/6c/swt.c +++ b/src/cmd/6c/swt.c @@ -320,7 +320,7 @@ outcode(void) zaddr(&b, &p->from, sf); zaddr(&b, &p->to, st); } - Bflush(&b); + Bterm(&b); close(f); firstp = P; lastp = P; diff --git a/src/cmd/8c/swt.c b/src/cmd/8c/swt.c index d331eee1ae..1b8ceb0c69 100644 --- a/src/cmd/8c/swt.c +++ b/src/cmd/8c/swt.c @@ -324,7 +324,7 @@ outcode(void) zaddr(&b, &p->from, sf); zaddr(&b, &p->to, st); } - Bflush(&b); + Bterm(&b); close(f); firstp = P; lastp = P; -- 2.50.0