Commit 32147ba780c39f6a2bb41c9ab6972cd88489986e

Philipp Wiesemann 2015-12-05T17:08:07

X11: Fixed memory leak when initializing multiple screens.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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");
     }