mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-24 11:41:58 +00:00
acme: fix double-free in acmeerrorproc
The receiver of cerr takes ownership of s.
This commit is contained in:
parent
90971376a5
commit
73661401ea
1 changed files with 2 additions and 4 deletions
|
@ -383,7 +383,7 @@ int erroutfd;
|
||||||
void
|
void
|
||||||
acmeerrorproc(void *v)
|
acmeerrorproc(void *v)
|
||||||
{
|
{
|
||||||
char *buf, *s;
|
char *buf;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
USED(v);
|
USED(v);
|
||||||
|
@ -391,9 +391,7 @@ acmeerrorproc(void *v)
|
||||||
buf = emalloc(8192+1);
|
buf = emalloc(8192+1);
|
||||||
while((n=read(errorfd, buf, 8192)) >= 0){
|
while((n=read(errorfd, buf, 8192)) >= 0){
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
s = estrdup(buf);
|
sendp(cerr, estrdup(buf));
|
||||||
sendp(cerr, s);
|
|
||||||
free(s);
|
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue