| Summary: | [SDL2 2.0.10] free(): invalid pointer / crashes ES after using Retroarch | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Frank <supervisedthinking> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | CLOSED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz, sylvain.becker |
| Version: | 2.0.10 | Keywords: | target-2.0.12 |
| Hardware: | ARM | ||
| OS: | Linux | ||
| Attachments: | fix by Ozkan Sezer | ||
|
Description
Frank
2019-08-20 08:55:23 UTC
I also opened an issue for ES https://github.com/RetroPie/EmulationStation/issues/591 since I can't be sure if ES is not faulty. Just a guess, but what about making sure global_cursor is initialized. eg: static SDL_Cursor *global_cursor = NULL; in: https://hg.libsdl.org/SDL/file/7693573f862d/src/video/raspberry/SDL_rpimouse.c#l54 I tried this patch but unfortunately it still crashs. --- a/src/video/raspberry/SDL_rpimouse.c +++ b/src/video/raspberry/SDL_rpimouse.c @@ -51,7 +51,7 @@ static void RPI_WarpMouse(SDL_Window * window, int x, int y); static int RPI_WarpMouseGlobal(int x, int y); -static SDL_Cursor *global_cursor; +static SDL_Cursor *global_cursor = NULL; static SDL_Cursor * RPI_CreateDefaultCursor(void) Looks like a double-free? Where is free() called, possibly from RPI_FreeCursor()? If so, RPI_FreeCursor() doesn't set global_cursor to NULL if cursor==global_cursor, maybe that's the reason. Try something like the following (untested) :
diff --git a/src/video/raspberry/SDL_rpimouse.c b/src/video/raspberry/SDL_rpimouse.c
--- 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;
+ }
}
}
Thx this patch solved the problem for me :-) I guess you'll send this patch upstream? Created attachment 3932 [details]
fix by Ozkan Sezer
Fix pushed as https://hg.libsdl.org/SDL/rev/5748bf293bea We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. |