diff --git a/src/x11_joystick.c b/src/x11_joystick.c index 2c711134..a240df59 100644 --- a/src/x11_joystick.c +++ b/src/x11_joystick.c @@ -80,8 +80,8 @@ static int openJoystickDevice(int joy, const char* path) ioctl(fd, JSIOCGBUTTONS, &numButtons); _glfw.x11.joystick[joy].numButtons = (int) numButtons; - _glfw.x11.joystick[joy].axis = (float*) malloc(sizeof(float) * numAxes); - _glfw.x11.joystick[joy].button = (unsigned char*) malloc(numButtons); + _glfw.x11.joystick[joy].axis = (float*) calloc(numAxes, sizeof(float)); + _glfw.x11.joystick[joy].button = (unsigned char*) calloc(numButtons, 1); _glfw.x11.joystick[joy].present = GL_TRUE; #endif // __linux__