aboutsummaryrefslogtreecommitdiff
path: root/src/libdraw
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-23 03:55:45 +0000
committerrsc <devnull@localhost>2006-05-23 03:55:45 +0000
commit24c4c46b98e19733700cdb0bccf1c56577f0f56a (patch)
tree9ee00399d59857022e46b7dd64b1688ff316d3c3 /src/libdraw
parent4b65e43c54c2ca1394babed18cc02f4fffc22e16 (diff)
downloadplan9port-24c4c46b98e19733700cdb0bccf1c56577f0f56a.tar.gz
plan9port-24c4c46b98e19733700cdb0bccf1c56577f0f56a.tar.bz2
plan9port-24c4c46b98e19733700cdb0bccf1c56577f0f56a.zip
fix _screen leak
Diffstat (limited to 'src/libdraw')
-rw-r--r--src/libdraw/devdraw.c21
-rw-r--r--src/libdraw/x11-init.c2
2 files changed, 8 insertions, 15 deletions
diff --git a/src/libdraw/devdraw.c b/src/libdraw/devdraw.c
index 74e10c31..f4a3fd96 100644
--- a/src/libdraw/devdraw.c
+++ b/src/libdraw/devdraw.c
@@ -549,6 +549,8 @@ drawfreedimage(DImage *dimage)
}
ds = dimage->dscreen;
l = dimage->image;
+ dimage->dscreen = nil; /* paranoia */
+ dimage->image = nil;
if(ds){
if(l->data == screenimage->data)
addflush(l->layer->screenr);
@@ -599,23 +601,14 @@ static
int
drawuninstall(Client *client, int id)
{
- DImage *d, *next;
+ DImage *d, **l;
- d = client->dimage[id&HASHMASK];
- if(d == 0)
- return -1;
- if(d->id == id){
- client->dimage[id&HASHMASK] = d->next;
- drawfreedimage(d);
- return 0;
- }
- while(next = d->next){ /* assign = */
- if(next->id == id){
- d->next = next->next;
- drawfreedimage(next);
+ for(l=&client->dimage[id&HASHMASK]; (d=*l) != nil; l=&d->next){
+ if(d->id == id){
+ *l = d->next;
+ drawfreedimage(d);
return 0;
}
- d = next;
}
return -1;
}
diff --git a/src/libdraw/x11-init.c b/src/libdraw/x11-init.c
index 277e8520..b824441b 100644
--- a/src/libdraw/x11-init.c
+++ b/src/libdraw/x11-init.c
@@ -154,6 +154,7 @@ getwindow(Display *d, int ref)
d->image = i;
/* fprint(2, "getwindow %p -> %p\n", oi, i); */
+ freescreen(_screen);
_screen = allocscreen(i, d->white, 0);
_freeimage1(screen);
screen = _allocwindow(screen, _screen, i->r, ref, DWhite);
@@ -550,7 +551,6 @@ xattach(char *label)
return _x.screenimage;
err0:
-fprint(2, "%r\n");
/*
* Should do a better job of cleaning up here.
*/