Mercurial > sdl-ios-xcode
comparison src/joystick/linux/SDL_sysjoystick.c @ 3089:0ea7b6bb4054
Fixed potential double-free crash
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 06 Mar 2009 05:53:33 +0000 |
parents | cfc8b35ad6b1 |
children | 09172593e9b6 |
comparison
equal
deleted
inserted
replaced
3088:1825768f1f72 | 3089:0ea7b6bb4054 |
---|---|
1208 SDL_SYS_JoystickQuit(void) | 1208 SDL_SYS_JoystickQuit(void) |
1209 { | 1209 { |
1210 int i; | 1210 int i; |
1211 | 1211 |
1212 for (i = 0; SDL_joylist[i].fname; ++i) { | 1212 for (i = 0; SDL_joylist[i].fname; ++i) { |
1213 SDL_free(SDL_joylist[i].fname); | 1213 if (SDL_joylist[i].fname) { |
1214 } | 1214 SDL_free(SDL_joylist[i].fname); |
1215 SDL_joylist[0].fname = NULL; | 1215 SDL_joylist[i].fname = NULL; |
1216 } | |
1217 } | |
1216 } | 1218 } |
1217 | 1219 |
1218 #endif /* SDL_JOYSTICK_LINUX */ | 1220 #endif /* SDL_JOYSTICK_LINUX */ |
1219 /* vi: set ts=4 sw=4 expandtab: */ | 1221 /* vi: set ts=4 sw=4 expandtab: */ |