diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-03 13:56:00 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-03 13:56:00 +0100 |
commit | 85c2a0d76ab109f2bec8f7dccab577033e6d37b0 (patch) | |
tree | 22e6774c3ba19287fbb6d6786cde7b3bf6f3092d /src/cairo-xlib-visual.c | |
parent | 41bef0fc385381b8c6b9091ec7ca2abe04cfc147 (diff) |
xlib: Unlike the visual when destroying it
Otherwise we leave dangling pointers in the visual list, leading to
memory corruption when using low bitdepth servers.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-xlib-visual.c')
-rw-r--r-- | src/cairo-xlib-visual.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cairo-xlib-visual.c b/src/cairo-xlib-visual.c index d9aac44ca..863822eeb 100644 --- a/src/cairo-xlib-visual.c +++ b/src/cairo-xlib-visual.c @@ -40,6 +40,7 @@ #include "cairo-xlib-private.h" #include "cairo-error-private.h" +#include "cairo-list-inline.h" /* A perceptual distance metric between two colors. No sqrt needed * since the square of the distance is still a valid metric. */ @@ -85,6 +86,7 @@ _cairo_xlib_visual_info_create (Display *dpy, if (unlikely (info == NULL)) return _cairo_error (CAIRO_STATUS_NO_MEMORY); + cairo_list_init (&info->link); info->visualid = visualid; /* Allocate a gray ramp and a color cube. @@ -185,6 +187,7 @@ void _cairo_xlib_visual_info_destroy (cairo_xlib_visual_info_t *info) { /* No need for XFreeColors() whilst using DefaultColormap */ + _cairo_list_del (&info->link); free (info); } |