Explorar o código

iOS: Fixed pointer dereference after free.

Philipp Wiesemann %!s(int64=10) %!d(string=hai) anos
pai
achega
774b077513
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      src/joystick/iphoneos/SDL_sysjoystick.m

+ 3 - 3
src/joystick/iphoneos/SDL_sysjoystick.m

@@ -228,9 +228,6 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
     }
 #endif /* SDL_JOYSTICK_MFI */
 
-    SDL_free(device->name);
-    SDL_free(device);
-
     --numjoysticks;
 
 #if !SDL_EVENTS_DISABLED
@@ -245,6 +242,9 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device)
     }
 #endif /* !SDL_EVENTS_DISABLED */
 
+    SDL_free(device->name);
+    SDL_free(device);
+
     return next;
 }