From f5ed4014dfede56fdf809e82691204f821e63885 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sat, 11 Feb 2012 11:51:34 +0000 Subject: [PATCH] Fix zero-size calloc when enumerating a joystick with no hats in SDL. git-svn-id: https://svn.eduke32.com/eduke32@2331 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/sdlayer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 92ae1eab3..81eeb9ece 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -518,7 +518,8 @@ int32_t initinput(void) joynumaxes,joynumbuttons,joynumhats); joyaxis = (int32_t *)Bcalloc(joynumaxes, sizeof(int32_t)); - joyhat = (int32_t *)Bcalloc(joynumhats, sizeof(int32_t)); + if (joynumhats) + joyhat = (int32_t *)Bcalloc(joynumhats, sizeof(int32_t)); for (i = 0; i < joynumhats; i++) joyhat[i] = -1; // centre