various memory errors in acme

This commit is contained in:
rsc 2007-02-11 18:42:11 +00:00
parent 35368876eb
commit cc0e11e417
2 changed files with 5 additions and 7 deletions

View file

@ -151,7 +151,7 @@ colclose(Column *c, Window *w, int dofree)
windelete(w); windelete(w);
winclose(w); winclose(w);
} }
memmove(c->w+i, c->w+i+1, (c->nw-i)*sizeof(Window*)); memmove(c->w+i, c->w+i+1, (c->nw-i-1)*sizeof(Window*));
c->nw--; c->nw--;
c->w = realloc(c->w, c->nw*sizeof(Window*)); c->w = realloc(c->w, c->nw*sizeof(Window*));
if(c->nw == 0){ if(c->nw == 0){

View file

@ -832,15 +832,13 @@ new(Text *et, Text *t, Text *argt, int flag1, int flag2, Rune *arg, int narg)
f = runemalloc(nf); f = runemalloc(nf);
runemove(f, arg, nf); runemove(f, arg, nf);
rs = dirname(et, f, nf); rs = dirname(et, f, nf);
f = rs.r;
nf = rs.nr;
memset(&e, 0, sizeof e); memset(&e, 0, sizeof e);
e.name = f; e.name = rs.r;
e.nname = nf; e.nname = rs.nr;
e.bname = runetobyte(f, nf); e.bname = runetobyte(rs.r, rs.nr);
e.jump = TRUE; e.jump = TRUE;
openfile(et, &e, FALSE); openfile(et, &e, FALSE);
free(f); free(e.name);
free(e.bname); free(e.bname);
arg = skipbl(a, na, &narg); arg = skipbl(a, na, &narg);
} }