From 6660797db084206ac808d17a8aff74216d61bcdc Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 21 Sep 2009 11:34:50 +0000 Subject: [PATCH] Fixed bug #638 Philipp Nordhus 2008-11-05 13:56:33 PST The Linux version of SDL_SYS_JoystickQuit() tries to free an invalid pointer when the number of joysticks was reduced since the last call. Reproduce: Connect two joysticks, call SDL_Init() and SDL_Quit(), then disconnect one joystick and call the functions again. --- src/joystick/linux/SDL_sysjoystick.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 66c19a6e7..68c53f6b7 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -1191,8 +1191,8 @@ void SDL_SYS_JoystickQuit(void) for ( i=0; SDL_joylist[i].fname; ++i ) { SDL_free(SDL_joylist[i].fname); + SDL_joylist[i].fname = NULL; } - SDL_joylist[0].fname = NULL; } #endif /* SDL_JOYSTICK_LINUX */