We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2859

Summary: Possible leak in SDL_DXGIGetOutputInfoin src\video\windows\SDL_windowsvideo.c
Product: SDL Reporter: Coriiander <coriiander>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: 2.0.3Keywords: triage-2.0.4
Hardware: All   
OS: Windows (All)   

Description Coriiander 2015-01-29 23:06:38 UTC
This report is about function "SDL_DXGIGetOutputInfo" in file "src\video\windows\SDL_windowsvideo.c".

The function attempts to release the resources acquired from DXGI_LoadDLL. It nicely releases the enumerated IDXGIOutputs and IDXGIAdapters. That's good. But at the end of the function, where you want to release the IDXGIFactory, you're actually incrementing its reference count (IDXGIFactory_AddRef) rather than releasing it (IDXGIFactory_Release).

The code, as it is now, says:

		/* free up the D3D stuff we inited */
		IDXGIFactory_AddRef( pDXGIFactory );
		SDL_UnloadObject(pDXGIDLL);

This should be:

		/* free up the D3D stuff we inited */
		IDXGIFactory_Release( pDXGIFactory );
		SDL_UnloadObject(pDXGIDLL);
Comment 1 Ryan C. Gordon 2015-02-19 06:32:15 UTC
Marking a large number of bugs with the "triage-2.0.4" keyword at once. Sorry
if you got a lot of email from this. This is to help me sort through some bugs
in regards to a 2.0.4 release. We may or may not fix this bug for 2.0.4,
though!
Comment 2 Ryan C. Gordon 2015-02-20 01:26:08 UTC
It appears this already got fixed as part of this commit...

    https://hg.libsdl.org/SDL/rev/135b8fef4adb

...so we're good to go here. Thanks!

--ryan.