fix some acme memory leaks

(imported from plan9port 7ca1c90109e17dced4b38fbaadea9d2cf39871b7,
some tag restoration lines not relevant.)
This commit is contained in:
Ori Bernstein 2019-12-06 12:08:00 -08:00
parent 450ec696ee
commit 480d7b8f5f
2 changed files with 6 additions and 2 deletions

View file

@ -307,15 +307,18 @@ static int errorfd;
void
acmeerrorproc(void *)
{
char *buf;
char *buf, *s;
int n;
threadsetname("acmeerrorproc");
buf = emalloc(8192+1);
while((n=read(errorfd, buf, 8192)) >= 0){
buf[n] = '\0';
sendp(cerr, estrdup(buf));
s = estrdup(buf);
sendp(cerr, s);
free(s);
}
free(buf);
}
void

View file

@ -159,6 +159,7 @@ execute(Text *t, uint aq0, uint aq1, int external, Text *argt)
aa = getbytearg(argt, TRUE, TRUE, &a);
if(a){
if(strlen(a) > EVENTSIZE){ /* too big; too bad */
free(r);
free(aa);
free(a);
warning(nil, "`argument string too long\n");