RPI_FreeCursor: set global_cursor to NULL to prevent double-free (bug 4769)
diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c
index 0a51a40..134ebf6 100644
--- a/src/video/raspberry/SDL_rpimouse.c
+++ b/src/video/raspberry/SDL_rpimouse.c
@@ -226,6 +226,9 @@ RPI_FreeCursor(SDL_Cursor * cursor)
SDL_free(cursor->driverdata);
}
SDL_free(cursor);
+ if (cursor == global_cursor) {
+ global_cursor = NULL;
+ }
}
}