| Summary: | Memory leak in DirectDraw backend | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Steven Don <shd> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | 1.2.13 | Keywords: | target-1.2.14 |
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
| Attachments: | Fix for memory leak | ||
When does surface->pixels get allocated prior to DX5_LockHWSurface()? In SDL_SetVideoMode. The reason I've left it in and don't just SDL_Free it immediately on a lock is on the off-chance that some badly behaved program grabs the pointer immediately after SDL_SetVideoMode and uses it. Freeing it immediately or not allocating it at all would break compatibility with such programs. Personally I think that should be avoided if it can be helped. Tagging this bug with "target-1.2.14" so we can try to resolve it for SDL 1.2.14. Please note that we may choose to resolve it as WONTFIX. This tag is largely so we have a comprehensive wishlist of bugs to examine for 1.2.14 (and so we can close bugs that we'll never fix, rather than have them live forever in Bugzilla). --ryan. Can you give me a test case that reproduces the memory leak? I'd like to fully understand what's going on before I apply this patch. Thanks! This is a risky change for SDL 1.2, so I'm going to hold off fixing it for now. If you have a test case, please re-open this bug. Thanks! |
Created attachment 333 [details] Fix for memory leak Certain codepaths in the DirectDraw backend for SDL 1.2 SDL_malloc a buffer which is never SDL_free'd. Instead, the pointer is simply overwritten by a pointer to a DirectDraw surface when the surface is locked. That is a memory leak. The patch attached stores the pointer for later proper release. I also posted this to the mailing list, and was directed to submit it here.