mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-03-12 04:01:17 +01:00
Fixed bug 5339 - Minor memory leak in SDL_x11events.c
wcodelyokoyt
The atom name that X11_GetAtomName() returns never gets freed, which result in a minor memory leak (14 bytes?) every time the user drops a file on a window.
You can see the line in question here:
6b6170caf6/src/video/x11/SDL_x11events.c (L1350)
Fix: call XFree on name after the while loop.
This commit is contained in:
parent
723d76c8ec
commit
1ef45c1801
@ -1380,6 +1380,7 @@ X11_DispatchEvent(_THIS)
|
|||||||
if (p.format == 8) {
|
if (p.format == 8) {
|
||||||
char *saveptr = NULL;
|
char *saveptr = NULL;
|
||||||
char *name = X11_XGetAtomName(display, target);
|
char *name = X11_XGetAtomName(display, target);
|
||||||
|
if (name) {
|
||||||
char *token = SDL_strtokr((char *) p.data, "\r\n", &saveptr);
|
char *token = SDL_strtokr((char *) p.data, "\r\n", &saveptr);
|
||||||
while (token != NULL) {
|
while (token != NULL) {
|
||||||
if (SDL_strcmp("text/plain", name) == 0) {
|
if (SDL_strcmp("text/plain", name) == 0) {
|
||||||
@ -1392,6 +1393,8 @@ X11_DispatchEvent(_THIS)
|
|||||||
}
|
}
|
||||||
token = SDL_strtokr(NULL, "\r\n", &saveptr);
|
token = SDL_strtokr(NULL, "\r\n", &saveptr);
|
||||||
}
|
}
|
||||||
|
X11_XFree(name);
|
||||||
|
}
|
||||||
SDL_SendDropComplete(data->window);
|
SDL_SendDropComplete(data->window);
|
||||||
}
|
}
|
||||||
X11_XFree(p.data);
|
X11_XFree(p.data);
|
||||||
|
Loading…
Reference in New Issue
Block a user