aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libdraw/alloc.c3
-rw-r--r--src/libdraw/init.c4
-rw-r--r--src/libdraw/x11-init.c4
3 files changed, 8 insertions, 3 deletions
diff --git a/src/libdraw/alloc.c b/src/libdraw/alloc.c
index c1fbe5a2..53e9605b 100644
--- a/src/libdraw/alloc.c
+++ b/src/libdraw/alloc.c
@@ -231,6 +231,9 @@ freeimage(Image *i)
{
int ret;
+ if(i == screen)
+ abort();
+
ret = _freeimage1(i);
free(i);
return ret;
diff --git a/src/libdraw/init.c b/src/libdraw/init.c
index 2fe18d21..2357f0ef 100644
--- a/src/libdraw/init.c
+++ b/src/libdraw/init.c
@@ -202,8 +202,8 @@ bufimage(Display *d, int n)
{
uchar *p;
- if(n<0 || n>d->bufsize){
-abort();
+ if(n<0 || d == nil || n>d->bufsize){
+ abort();
werrstr("bad count in bufimage");
return 0;
}
diff --git a/src/libdraw/x11-init.c b/src/libdraw/x11-init.c
index 72292671..a640e2ee 100644
--- a/src/libdraw/x11-init.c
+++ b/src/libdraw/x11-init.c
@@ -137,8 +137,10 @@ getwindow(Display *d, int ref)
Image *i;
Image *oi;
- if(_x.destroyed)
+ if(_x.destroyed){
postnote(PNGROUP, getpgrp(), "hangup");
+ return -1;
+ }
if(xreplacescreenimage() == 0)
return 0;