xlib: fix memory leak on Display close
The XMesaVisual instances freed in the visuals table on display close are being freed with a free() call, instead of XMesaDestroyVisual(), causing a memory leak. Signed-off-by: John Sheu <sheu@google.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
@@ -794,7 +794,7 @@ destroy_visuals_on_display(Display *dpy)
|
||||
if (VisualTable[i]->display == dpy) {
|
||||
/* remove this visual */
|
||||
int j;
|
||||
free(VisualTable[i]);
|
||||
XMesaDestroyVisual(VisualTable[i]);
|
||||
for (j = i; j < NumVisuals - 1; j++)
|
||||
VisualTable[j] = VisualTable[j + 1];
|
||||
NumVisuals--;
|
||||
|
||||
@@ -856,6 +856,7 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
|
||||
accum_red_size, accum_green_size,
|
||||
accum_blue_size, accum_alpha_size,
|
||||
0)) {
|
||||
free(v->visinfo);
|
||||
free(v);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user