From f7ad816c5c13d334f1c0d350041e95cb507e47bc Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 12 Mar 2013 17:57:13 -0400 Subject: [PATCH] cmd/ld: fix 'use after free' error in new obj code Many thanks to Elias Naur for finding this with Valgrind on Linux. Perhaps this is what is breaking the windows/amd64 builder. R=golang-dev, r CC=golang-dev https://golang.org/cl/7595044 --- src/cmd/ld/lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c index cbd947dc82..450a83716e 100644 --- a/src/cmd/ld/lib.c +++ b/src/cmd/ld/lib.c @@ -528,7 +528,7 @@ ldhostobj(void (*ld)(Biobuf*, char*, int64, char*), Biobuf *f, char *pkg, int64 } h = &hostobj[nhostobj++]; h->ld = ld; - h->pkg = pkg; + h->pkg = estrdup(pkg); h->pn = estrdup(pn); h->file = estrdup(file); h->off = Boffset(f); -- 2.48.1