X11: Fixed memory leak when initializing multiple screens.
diff --git a/src/video/x11/SDL_x11modes.c b/src/video/x11/SDL_x11modes.c
index d3f8874..d213636 100644
--- a/src/video/x11/SDL_x11modes.c
+++ b/src/video/x11/SDL_x11modes.c
@@ -491,11 +491,11 @@ X11_InitModes_XRandR(_THIS)
display.driverdata = displaydata;
SDL_AddVideoDisplay(&display);
}
+
+ X11_XRRFreeScreenResources(res);
}
}
- X11_XRRFreeScreenResources(res);
-
if (_this->num_displays == 0) {
return SDL_SetError("No available displays");
}