On Sun, May 8, 2016 at 9:54 PM, Stefan Dösinger stefandoesinger@gmail.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Am 2016-05-08 um 11:31 schrieb Aaryaman Vasishta:
- /* d3drm intentionally leaks a reference to IDirect3DRM here if
texture has already been initialized. */
- if (texture->d3drm)
IDirect3DRM_AddRef(texture->d3drm);
- if (texture->image)
return D3DRMERR_BADOBJECT;
- if (FAILED(hr = d3drm_texture_load(texture, filename, FALSE)))
return hr;
Does it also leak if the file fails to load? It's probably better to create the image and then pass it to InitFromImage instead of re-coding this part.
Not afair while writing the tests, but it will leak if the texture was
already initialized.
Is there any situation where texture->d3drm would be NULL? The same question applies to the newly introduced check in d3drm_texture_destroy.
At this point, LoadTexture is not implemented yet. Currently LoadTexture doesn't assign d3drm1, which means that check will be needed in case a texture created by LoadTexture needs to be released. I've removed the NULL check in the next patch after LoadTexture is implemented.
Cheers, Aaryaman