mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-24 12:30:59 +00:00
X11: Fixed a memory leak when adding duplicate display modes.
This commit is contained in:
parent
fcc5940935
commit
ca46804210
|
@ -748,7 +748,9 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
||||||
}
|
}
|
||||||
mode.driverdata = modedata;
|
mode.driverdata = modedata;
|
||||||
SDL_AddDisplayMode(sdl_display, &mode);
|
if (!SDL_AddDisplayMode(sdl_display, &mode)) {
|
||||||
|
SDL_free(modedata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!data->use_xrandr)
|
else if (!data->use_xrandr)
|
||||||
{
|
{
|
||||||
|
@ -762,7 +764,9 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
||||||
}
|
}
|
||||||
mode.driverdata = modedata;
|
mode.driverdata = modedata;
|
||||||
SDL_AddDisplayMode(sdl_display, &mode);
|
if (!SDL_AddDisplayMode(sdl_display, &mode)) {
|
||||||
|
SDL_free(modedata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -787,9 +791,8 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
}
|
}
|
||||||
mode.driverdata = modedata;
|
mode.driverdata = modedata;
|
||||||
|
|
||||||
if (SetXRandRModeInfo(display, res, output_info, output_info->modes[i], &mode)) {
|
if (!SetXRandRModeInfo(display, res, output_info, output_info->modes[i], &mode) ||
|
||||||
SDL_AddDisplayMode(sdl_display, &mode);
|
!SDL_AddDisplayMode(sdl_display, &mode)) {
|
||||||
} else {
|
|
||||||
SDL_free(modedata);
|
SDL_free(modedata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -822,9 +825,7 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
}
|
}
|
||||||
mode.driverdata = modedata;
|
mode.driverdata = modedata;
|
||||||
|
|
||||||
if (SetXVidModeModeInfo(modes[i], &mode)) {
|
if (!SetXVidModeModeInfo(modes[i], &mode) || !SDL_AddDisplayMode(sdl_display, &mode)) {
|
||||||
SDL_AddDisplayMode(sdl_display, &mode);
|
|
||||||
} else {
|
|
||||||
SDL_free(modedata);
|
SDL_free(modedata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -842,7 +843,9 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display)
|
||||||
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
*modedata = *(SDL_DisplayModeData *)sdl_display->desktop_mode.driverdata;
|
||||||
}
|
}
|
||||||
mode.driverdata = modedata;
|
mode.driverdata = modedata;
|
||||||
SDL_AddDisplayMode(sdl_display, &mode);
|
if (!SDL_AddDisplayMode(sdl_display, &mode)) {
|
||||||
|
SDL_free(modedata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue