소스 검색

Added allocation failure check.

Camilla Berglund 13 년 전
부모
커밋
c87829ea61
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      src/win32_monitor.c

+ 5 - 0
src/win32_monitor.c

@@ -124,6 +124,11 @@ _GLFWmonitor** _glfwPlatformGetMonitors(int* count)
                     size = 4;
                     size = 4;
 
 
                 monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size);
                 monitors = (_GLFWmonitor**) realloc(monitors, sizeof(_GLFWmonitor*) * size);
+                if (!monitors)
+                {
+                    // TODO: wat
+                    return NULL;
+                }
             }
             }
 
 
             monitors[found] = _glfwCreateMonitor(name,
             monitors[found] = _glfwCreateMonitor(name,