Fixed read after free bug in the game controller.
This commit is contained in:
parent
69b8182419
commit
1dec4dd800
1 changed files with 5 additions and 4 deletions
|
@ -678,17 +678,18 @@ SDL_GameControllerAddMapping( const char *mappingString )
|
|||
SDL_bool is_xinput_mapping = SDL_FALSE;
|
||||
#endif
|
||||
|
||||
pchGUID = SDL_PrivateGetControllerGUIDFromMappingString( mappingString );
|
||||
if (!pchGUID) return -1;
|
||||
pchGUID = SDL_PrivateGetControllerGUIDFromMappingString( mappingString );
|
||||
if (!pchGUID) {
|
||||
return -1;
|
||||
}
|
||||
#ifdef SDL_JOYSTICK_DINPUT
|
||||
if ( !SDL_strcasecmp( pchGUID, "xinput" ) ) {
|
||||
is_xinput_mapping = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
|
||||
SDL_free(pchGUID);
|
||||
|
||||
jGUID = SDL_JoystickGetGUIDFromString(pchGUID);
|
||||
|
||||
pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID);
|
||||
|
||||
pchName = SDL_PrivateGetControllerNameFromMappingString( mappingString );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue