Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed read after free bug in the game controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Mar 7, 2013
1 parent ad0f387 commit 179636a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/joystick/SDL_gamecontroller.c
Expand Up @@ -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 );
Expand Down

0 comments on commit 179636a

Please sign in to comment.