Skip to content

Memory leak in DirectDraw backend #484

Closed

Description

@SDLBugzilla

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 1.2.13
Reported for operating system, platform: Windows (All), x86

Comments on the original bug report:

On 2009-06-20 14:33:05 +0000, Steven Don wrote:

Created attachment 333
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.

On 2009-06-30 22:11:39 +0000, Sam Lantinga wrote:

When does surface->pixels get allocated prior to DX5_LockHWSurface()?

On 2009-07-01 11:01:15 +0000, Steven Don wrote:

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.

On 2009-09-13 16:33:01 +0000, Ryan C. Gordon wrote:

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.

On 2009-09-26 21:06:21 +0000, Sam Lantinga wrote:

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!

On 2009-10-17 11:08:40 +0000, Sam Lantinga wrote:

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions