Mir: Fixed crash if allocating memory for cursor failed.
--- a/src/video/mir/SDL_mirmouse.c Sun Feb 21 19:21:21 2016 -0500
+++ b/src/video/mir/SDL_mirmouse.c Mon Feb 22 19:00:22 2016 +0100
@@ -59,6 +59,8 @@
}
else {
SDL_OutOfMemory();
+ SDL_free(cursor);
+ cursor = NULL;
}
}
else {
@@ -108,7 +110,13 @@
MIR_Data* mir_data = (MIR_Data*)SDL_GetVideoDevice()->driverdata;
SDL_Cursor* cursor = MIR_CreateDefaultCursor();
- MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata;
+ MIR_Cursor* mir_cursor;
+
+ if (!cursor) {
+ return NULL;
+ }
+
+ mir_cursor = (MIR_Cursor*)cursor->driverdata;
stream = MIR_mir_connection_create_buffer_stream_sync(mir_data->connection,
s_w, s_h, mir_data->pixel_format,
@@ -132,6 +140,10 @@
MirCursorConfiguration* conf;
SDL_Cursor* cursor = MIR_CreateDefaultCursor();
+ if (!cursor) {
+ return NULL;
+ }
+
switch(id) {
case SDL_SYSTEM_CURSOR_ARROW:
cursor_name = MIR_mir_arrow_cursor_name;