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 5018 - D3D_RenderReadPixels - possible memory leak
Summary: D3D_RenderReadPixels - possible memory leak
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: HG 2.1
Hardware: x86_64 All
: P2 major
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-08 10:23 UTC by Konrad
Modified: 2020-03-09 01:56 UTC (History)
0 users

See Also:


Attachments
Fix (469 bytes, patch)
2020-03-08 10:23 UTC, Konrad
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad 2020-03-08 10:23:23 UTC
Created attachment 4243 [details]
Fix

It appears that backbuffer is not released at the end of the function like in any previous error return within if.

Patch included.
Comment 1 Sam Lantinga 2020-03-08 22:49:41 UTC
Actually, it looks like releasing the backbuffer isn't correct here, and should be removed from the error handling. We're just copying the pointer at the top of the function, not increasing the reference count to it...
Comment 2 Konrad 2020-03-08 22:54:52 UTC
Ahh, you are perfectly right.

I was using GetRenderTarget myself in a different application which does increase ref count, but I didn't notice that SDL2 does not get it, but just copy the already acquired pointer.
Comment 3 Sam Lantinga 2020-03-09 01:56:57 UTC
I fixed it so it doesn't release the backbuffer on error.

Thanks!