Fix memory leak:

==15753== 24 bytes in 1 blocks are definitely lost in loss record 22 of 71
==15753==    at 0x4C2CC70: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==15753==    by 0x40BAE1: _glfwPlatformGetVideoModes (wl_monitor.c:216)
==15753==    by 0x40B9D6: _glfwPlatformGetMonitors (wl_monitor.c:184)
==15753==    by 0x406151: glfwInit (init.c:131)
==15753==    by 0x4052AE: main (simple.c:49)
This commit is contained in:
Denis Biryukov 2015-03-24 13:11:15 +03:00
parent 5268914b3f
commit e4f708da3b

View File

@ -180,10 +180,9 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
_GLFWmonitor* origMonitor = _glfw.wl.monitors[i];
monitor = calloc(1, sizeof(_GLFWmonitor));
monitor->modes =
_glfwPlatformGetVideoModes(origMonitor,
&origMonitor->wl.modesCount);
*monitor = *_glfw.wl.monitors[i];
monitor->modes = _glfwPlatformGetVideoModes(origMonitor, &origMonitor->wl.modesCount);
monitor->modeCount = origMonitor->wl.modesCount;
monitors[i] = monitor;
}