iOS: Fixed pointer dereference after free.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Mon, 21 Sep 2015 21:19:37 +0200
changeset 9878 63f03a567fe3
parent 9877 e6fa7403893b
child 9879 8465a79c9f85
iOS: Fixed pointer dereference after free.
src/joystick/iphoneos/SDL_sysjoystick.m
--- a/src/joystick/iphoneos/SDL_sysjoystick.m	Mon Sep 21 21:16:54 2015 +0200
+++ b/src/joystick/iphoneos/SDL_sysjoystick.m	Mon Sep 21 21:19:37 2015 +0200
@@ -228,9 +228,6 @@
     }
 #endif /* SDL_JOYSTICK_MFI */
 
-    SDL_free(device->name);
-    SDL_free(device);
-
     --numjoysticks;
 
 #if !SDL_EVENTS_DISABLED
@@ -245,6 +242,9 @@
     }
 #endif /* !SDL_EVENTS_DISABLED */
 
+    SDL_free(device->name);
+    SDL_free(device);
+
     return next;
 }