Skip to content

Commit

Permalink
Fixed potential double-free in mouse cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jun 18, 2019
1 parent 5dcac4c commit 3e720d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -348,10 +348,9 @@ + (NSCursor *)invisibleCursor

Cocoa_InitMouseEventTap(mouse->driverdata);

SDL_MouseData *driverdata = (SDL_MouseData*)mouse->driverdata;
const NSPoint location = [NSEvent mouseLocation];
driverdata->lastMoveX = location.x;
driverdata->lastMoveY = location.y;
mouse->driverdata->lastMoveX = location.x;
mouse->driverdata->lastMoveY = location.y;
}

void
Expand Down Expand Up @@ -482,9 +481,10 @@ + (NSCursor *)invisibleCursor
if (mouse) {
if (mouse->driverdata) {
Cocoa_QuitMouseEventTap(((SDL_MouseData*)mouse->driverdata));
}

SDL_free(mouse->driverdata);
SDL_free(mouse->driverdata);
mouse->driverdata = NULL;
}
}
}

Expand Down

0 comments on commit 3e720d2

Please sign in to comment.