From 296632c8d2d2bbf5d4800634b48622635ccac786 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 30 Apr 2013 17:03:09 +0200 Subject: [PATCH] Fixed joystick state not being initialized. --- src/x11_joystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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__