more memory errors (valgrind)
This commit is contained in:
parent
96f54e3fff
commit
40402738da
3 changed files with 3 additions and 1 deletions
|
|
@ -26,6 +26,7 @@ morecode(void)
|
||||||
if(codebuf==0)
|
if(codebuf==0)
|
||||||
panic("Can't realloc %d bytes in morecode!",
|
panic("Can't realloc %d bytes in morecode!",
|
||||||
ncode*sizeof codebuf[0]);
|
ncode*sizeof codebuf[0]);
|
||||||
|
memset(codebuf+ncode-100, 0, 100*sizeof codebuf[0]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ pfmt(io *f, char *fmt, ...)
|
||||||
pwrd(f, va_arg(ap, char *));
|
pwrd(f, va_arg(ap, char *));
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
errstr(err, sizeof err); pstr(f, err);
|
rerrstr(err, sizeof err); pstr(f, err);
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
pstr(f, va_arg(ap, char *));
|
pstr(f, va_arg(ap, char *));
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ emalloc(long n)
|
||||||
if(p==0)
|
if(p==0)
|
||||||
panic("Can't malloc %d bytes", n);
|
panic("Can't malloc %d bytes", n);
|
||||||
/* if(err){ pfmt(err, "malloc %d->%p\n", n, p); flush(err); } /**/
|
/* if(err){ pfmt(err, "malloc %d->%p\n", n, p); flush(err); } /**/
|
||||||
|
memset(p, 0, n);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue