summaryrefslogtreecommitdiff
path: root/sys/src/cmd/mothra/mothra.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-31 09:43:24 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-31 09:43:24 +0200
commit02acb1d4f00648b3ececd8fee2dc065f868e432e (patch)
tree43cfc9e8c944c75d2d6223551cbbb2bfa91cb5fa /sys/src/cmd/mothra/mothra.c
parenta5d30a3d043c099bec912134c53c8d47a0ff7850 (diff)
mothra: make emalloc zero memory, fix uninitialized nextline pointer crash
Diffstat (limited to 'sys/src/cmd/mothra/mothra.c')
-rw-r--r--sys/src/cmd/mothra/mothra.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/sys/src/cmd/mothra/mothra.c b/sys/src/cmd/mothra/mothra.c
index 44ca1db15..5bedc1fe7 100644
--- a/sys/src/cmd/mothra/mothra.c
+++ b/sys/src/cmd/mothra/mothra.c
@@ -458,14 +458,7 @@ void *emalloc(int n){
v=malloc(n);
if(v==0)
sysfatal("out of memory");
- setmalloctag(v, getcallerpc(&n));
- return v;
-}
-void *emallocz(int n, int z){
- void *v;
- v = emalloc(n);
- if(z)
- memset(v, 0, n);
+ memset(v, 0, n);
setmalloctag(v, getcallerpc(&n));
return v;
}
@@ -982,7 +975,7 @@ mothon(Www *w, int on)
x = t->next;
if(on){
t->next = nil;
- ap=mallocz(sizeof(Action), 1);
+ ap=emalloc(sizeof(Action));
ap->link = strdup(a->link);
plrtstr(&t->next, 0, 0, t->font, strdup("->"), 1, ap);
t->next->next = x;