Commit eb9cc0306867c0bfddae64e9f0aa4f6fdf75bdbc

Philipp Wiesemann 2016-11-19T23:27:37

Fixed two memory leaks if added game controller mapping has lower priority. Found by buildbot.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c
index 2f32a32..f8c5ad7 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 {