Fixed a small Memory Leak

This commit is contained in:
fryshorts 2014-04-26 01:34:35 +02:00
parent dc6a17be2e
commit 9dc2cd7d7e

View File

@ -17,7 +17,7 @@
******************************************************************************/
/* Here we use xinerama to fetch data about monitor geometry
* Even if there are not multiple monitors, this should still work.
* Even if there are not multiple monitors, this should still work.
*/
#include <X11/Xlib.h>
@ -75,7 +75,7 @@ void GetMonitors(vector<MonitorInfo> &monitors)
screens = XineramaQueryScreens(display, &num_screens);
if (num_screens == 0 || !screens) {
if (num_screens == 0 || !screens) {
printf("Xinerama isn't active on this screen.\n");
return;
}
@ -86,13 +86,14 @@ void GetMonitors(vector<MonitorInfo> &monitors)
--num_screens;
monitors.emplace_back(
screens[num_screens].x_org,
screens[num_screens].x_org,
screens[num_screens].y_org,
screens[num_screens].width,
screens[num_screens].height
);
} while (num_screens > 0);
XFree(screens);
XCloseDisplay(display);
}