From eb9cc0306867c0bfddae64e9f0aa4f6fdf75bdbc Mon Sep 17 00:00:00 2001 From: Philipp Wiesemann Date: Sat, 19 Nov 2016 23:27:37 +0100 Subject: [PATCH] Fixed two memory leaks if added game controller mapping has lower priority. Found by buildbot. --- src/joystick/SDL_gamecontroller.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 2f32a32630723..f8c5ad7896352 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -675,6 +675,9 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, pControllerMapping->priority = priority; /* refresh open controllers */ SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + } else { + SDL_free(pchName); + SDL_free(pchMapping); } *existing = SDL_TRUE; } else {