Fix crashes occurring when XDestroyImage() tries to free image data.

XDestroyImage() assumes that it can call free() on the data pointed to
by the XImage structure it is passed.  However, the data may have come
from the strange malloc(), in which case calling free() on it is a
guaranteed crash.  Unfortunately, we have no way of knowing here if
this is the case or not, so we must always set gdisp->gg.img->data and
gdisp->gg.mask->data to NULL and live with the resulting memory leak
when we are wrong.