dri/common: clear the loaderPrivate pointer in driDestroyDrawable
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 27 Jan 2017 10:55:14 +0000 (11:55 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 6 Feb 2017 16:39:44 +0000 (17:39 +0100)
commit7be0e602ed82d25b9f0db77748618c663d9cbfe7
tree808c9c44ff709f7953fee1ea7dfb405f79c7ed05
parentf446f3fb33528eebe9b120340fca3ac5c5ba518d
dri/common: clear the loaderPrivate pointer in driDestroyDrawable

The GLX specification says about glXDestroyPixmap:

    "The storage for the GLX pixmap will be freed when it is not current
     to any client."

We're not really following this language to the letter: some of the storage
is freed immediately (in particular, the dri3_drawable, which contains both
GLXDRIdrawable and loader_dri3_drawable). So we NULL out the pointers to
that freed storage; the previous patches added the corresponding NULL-pointer
checks.

This fixes memory corruption in piglit
./bin/glx-visuals-depth/stencil -pixmap -auto

Cc: 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
src/mesa/drivers/dri/common/dri_util.c