| Summary: | SDL_free() fails in function SDL_WM_SetCaption | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ian Carvalho <ian> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| URL: | http://www.libsdl.org/cgi/viewvc.cgi/trunk/SDL/src/SDL_compat.c?revision=2708&view=markup | ||
This is fixed in subversion, thanks! |
When running the program luvcview the following error is reported: *** glibc detected *** free(): invalid next size (fast): 0x08066830 *** On tracing it turns out to fail from SDL_WM_SetCaption() On going through the function it looks like the SDL_free() function is called every alternate time with an invalid pointer that has already been freed. To fix: remove the else in the statement. Even better validate "title" and only if valid execute the code in the function. The following is what I think the new code should look like... Please verify. --- start new code --- void SDL_WM_SetCaption(const char *title, const char *icon) { if (title) { if (wm_title) { SDL_free(wm_title); } wm_title = SDL_strdup(title); SDL_SetWindowTitle(SDL_VideoWindow, wm_title); } } --- end new code ---