mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 01:15:35 +00:00
Fixed bug 2502 - Memory leak inside SDL_x11events.c -> X11_DispatchEvent(_THIS)
bojko_1000 Code @566: if (data->xwindow) { Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); Atom type = None; int format; unsigned long nitems = 0, bytes_after; unsigned char *property; X11_XGetWindowProperty(display, data->xwindow, _net_frame_extents, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property); if (type != None && nitems == 4) { border_left = ((long*)property)[0]; border_right = ((long*)property)[1]; border_top = ((long*)property)[2]; border_bottom = ((long*)property)[3]; } } Code after _the fix_: if (data->xwindow) { Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); Atom type = None; int format; unsigned long nitems = 0, bytes_after; unsigned char *property; X11_XGetWindowProperty(display, data->xwindow, _net_frame_extents, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property); if (type != None && nitems == 4) { border_left = ((long*)property)[0]; border_right = ((long*)property)[1]; border_top = ((long*)property)[2]; border_bottom = ((long*)property)[3]; } X11_XFree(property); } I have found that leak with valgrind.
This commit is contained in:
parent
f4b77110d2
commit
f6953cf4c2
|
@ -563,19 +563,20 @@ X11_DispatchEvent(_THIS)
|
|||
long border_top = 0;
|
||||
if (data->xwindow) {
|
||||
Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0);
|
||||
Atom type = None;
|
||||
Atom type;
|
||||
int format;
|
||||
unsigned long nitems = 0, bytes_after;
|
||||
unsigned long nitems, bytes_after;
|
||||
unsigned char *property;
|
||||
X11_XGetWindowProperty(display, data->xwindow,
|
||||
_net_frame_extents, 0, 16, 0,
|
||||
XA_CARDINAL, &type, &format,
|
||||
&nitems, &bytes_after, &property);
|
||||
|
||||
if (type != None && nitems == 4)
|
||||
{
|
||||
border_left = ((long*)property)[0];
|
||||
border_top = ((long*)property)[2];
|
||||
if (X11_XGetWindowProperty(display, data->xwindow,
|
||||
_net_frame_extents, 0, 16, 0,
|
||||
XA_CARDINAL, &type, &format,
|
||||
&nitems, &bytes_after, &property) == Success) {
|
||||
if (type != None && nitems == 4)
|
||||
{
|
||||
border_left = ((long*)property)[0];
|
||||
border_top = ((long*)property)[2];
|
||||
}
|
||||
X11_XFree(property);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue