mirror of
https://github.com/glfw/glfw.git
synced 2024-11-30 05:47:10 +00:00
Replaced malloc and memset with calloc.
This commit is contained in:
parent
5fcfcb2ddc
commit
21a015778f
@ -308,15 +308,13 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
|
|||||||
height = 480;
|
height = 480;
|
||||||
}
|
}
|
||||||
|
|
||||||
window = (_GLFWwindow*) malloc(sizeof(_GLFWwindow));
|
window = (_GLFWwindow*) calloc(1, sizeof(_GLFWwindow));
|
||||||
if (!window)
|
if (!window)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
_glfwSetError(GLFW_OUT_OF_MEMORY, NULL);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(window, 0, sizeof(_GLFWwindow));
|
|
||||||
|
|
||||||
window->next = _glfwLibrary.windowListHead;
|
window->next = _glfwLibrary.windowListHead;
|
||||||
_glfwLibrary.windowListHead = window;
|
_glfwLibrary.windowListHead = window;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user