sam: fix memory leak

front
cinap_lenrek 2011-08-17 17:48:43 +02:00
parent 982ee70f45
commit c8c58f8cfd
2 changed files with 4 additions and 3 deletions

View File

@ -138,7 +138,7 @@ termwrite(char *s)
else
Strinsert(&cmdstr, p, cmdstr.n);
cmdptadv += p->n;
free(p);
freetmpstr(p);
}else
Write(2, s, strlen(s));
}

View File

@ -136,10 +136,10 @@ emalloc(ulong n)
{
void *p;
p = malloc(n);
p = mallocz(n, 1);
if(p == 0)
panic("malloc fails");
memset(p, 0, n);
setmalloctag(p, getcallerpc(&n));
return p;
}
@ -149,5 +149,6 @@ erealloc(void *p, ulong n)
p = realloc(p, n);
if(p == 0)
panic("realloc fails");
setmalloctag(p, getcallerpc(&p));
return p;
}