diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-04 21:27:59 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-09-04 21:27:59 +0200 |
commit | cca9a1b52381fe2c839350226eceeb1cc987c27f (patch) | |
tree | 173e3d8053b1a98b36cf2a2849e45a4d2df41c94 /sys/src/cmd/abaco/html.c | |
parent | 32236b49573cbc081515883d4d371c4a160daeb9 (diff) |
abaco: fix memory leaks
Diffstat (limited to 'sys/src/cmd/abaco/html.c')
-rw-r--r-- | sys/src/cmd/abaco/html.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/src/cmd/abaco/html.c b/sys/src/cmd/abaco/html.c index 9a53eec53..633f02e06 100644 --- a/sys/src/cmd/abaco/html.c +++ b/sys/src/cmd/abaco/html.c @@ -731,7 +731,7 @@ boxalloc(Line *l, Item *i, Rectangle r) l->lastbox->next = b; } l->lastbox = b; - + setmalloctag(b, getcallerpc(&l)); return b; } @@ -961,8 +961,9 @@ layitems(Item *items, Rectangle r, int laying) void laypage(Page *p) { - settables(p); layfree(p->lay); + p->lay = nil; + settables(p); p->lay = layitems(p->items, Rect(0,0,Dx(p->r),Dy(p->r)), TRUE); p->lay->r.max.y = max(p->lay->r.max.y, Dy(p->r)); } @@ -1015,16 +1016,17 @@ layfree(Lay *lay) for(l=lay->lines; l!=nil; l=nextline){ for(b=l->boxes; b!=nil; b=nextbox){ nextbox = b->next; - if(b->i->tag==Iformfieldtag && istextfield(b->i)){ - aux = &((Iformfield *)b->i)->aux; - if(*aux){ - textclose(*aux); - free(*aux); - } - *aux = nil; - }else if(b->i->tag == Itabletag) - laytablefree(((Itable *)b->i)->table); - + if(lay->laying==TRUE){ + if(b->i->tag==Iformfieldtag && istextfield(b->i)){ + aux = &((Iformfield *)b->i)->aux; + if(*aux){ + textclose(*aux); + free(*aux); + } + *aux = nil; + }else if(b->i->tag == Itabletag) + laytablefree(((Itable *)b->i)->table); + } free(b); } nextline = l->next; |