Commit 1e47790c8d2aac850aacc751f169f4ef0456521e

Ozkan Sezer 2019-08-26T18:41:40

RPI_FreeCursor: set global_cursor to NULL to prevent double-free (bug 4769)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
+        }
     }
 }