# HG changeset patch # User Sam Lantinga # Date 1253532890 0 # Node ID dbdf8b108e31c0879444dac87480a7ea5136aa24 # Parent 6c1d2039b6b4e3df85e06d142f0d8cd7c25b1283 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. diff -r 6c1d2039b6b4 -r dbdf8b108e31 src/joystick/linux/SDL_sysjoystick.c --- a/src/joystick/linux/SDL_sysjoystick.c Mon Sep 21 11:32:58 2009 +0000 +++ b/src/joystick/linux/SDL_sysjoystick.c Mon Sep 21 11:34:50 2009 +0000 @@ -1191,8 +1191,8 @@ 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 */