summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2021-01-18 14:30:40 -0500
committerRuss Cox <rsc@swtch.com>2021-03-23 17:03:56 -0400
commit73661401ea00ef6a862d0a4b292e091b319c25bc (patch)
treee2ad311879404f8e7ca0b4f12957e22835dfc312
parent90971376a5e8620fc62579aa1b3be26245ec8c06 (diff)
downloadplan9port-73661401ea00ef6a862d0a4b292e091b319c25bc.tar.gz
plan9port-73661401ea00ef6a862d0a4b292e091b319c25bc.zip
acme: fix double-free in acmeerrorproc
The receiver of cerr takes ownership of s.
-rw-r--r--src/cmd/acme/acme.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
index e5658a4e..d001a2a8 100644
--- a/src/cmd/acme/acme.c
+++ b/src/cmd/acme/acme.c
@@ -383,7 +383,7 @@ int erroutfd;
void
acmeerrorproc(void *v)
{
- char *buf, *s;
+ char *buf;
int n;
USED(v);
@@ -391,9 +391,7 @@ acmeerrorproc(void *v)
buf = emalloc(8192+1);
while((n=read(errorfd, buf, 8192)) >= 0){
buf[n] = '\0';
- s = estrdup(buf);
- sendp(cerr, s);
- free(s);
+ sendp(cerr, estrdup(buf));
}
free(buf);
}