acme: fix some memory leaks

This commit is contained in:
Xiao-Yong Jin 2018-03-20 22:15:12 -05:00 committed by David du Colombier
parent 96dc233091
commit 7ca1c90109
3 changed files with 8 additions and 2 deletions

View file

@ -383,7 +383,7 @@ int erroutfd;
void
acmeerrorproc(void *v)
{
char *buf;
char *buf, *s;
int n;
USED(v);
@ -391,8 +391,11 @@ acmeerrorproc(void *v)
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

@ -194,6 +194,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");

View file

@ -613,6 +613,7 @@ rowload(Row *row, char *file, int initing)
}
textdelete(&row->col[i]->tag, 0, row->col[i]->tag.file->b.nc, TRUE);
textinsert(&row->col[i]->tag, 0, r+n+1, nr-(n+1), TRUE);
free(r);
break;
case 'w':
l[Blinelen(b)-1] = 0;
@ -626,6 +627,7 @@ rowload(Row *row, char *file, int initing)
}
textdelete(&row->tag, 0, row->tag.file->b.nc, TRUE);
textinsert(&row->tag, 0, r, nr, TRUE);
free(r);
break;
default:
done = 1;