Commit 1887c54c6895675b47149735b4bda1f344f260e6

Sam Lantinga 2017-10-12T13:28:48

Fixed memory leak in Cocoa mouse code The video quit call cleans up the mouse cursor driver data, which happens after mouse quit

diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c
index 7a7bb2e..794eafe 100644
--- a/src/events/SDL_mouse.c
+++ b/src/events/SDL_mouse.c
@@ -81,6 +81,8 @@ SDL_MouseInit(void)
 {
     SDL_Mouse *mouse = SDL_GetMouse();
 
+    SDL_zerop(mouse);
+
     SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
                         SDL_MouseNormalSpeedScaleChanged, mouse);
 
@@ -587,8 +589,6 @@ SDL_MouseQuit(void)
         SDL_free(mouse->clickstate);
     }
 
-    SDL_zerop(mouse);
-
     SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE,
                         SDL_MouseNormalSpeedScaleChanged, mouse);