diff src/joystick/linux/SDL_sysjoystick.c @ 4226:dbdf8b108e31 SDL-1.2

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.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 21 Sep 2009 11:34:50 +0000
parents cc865a058a0c
children 0530394b5830
line wrap: on
line diff
--- 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 */