2017-02-14 15:15 GMT-07:00 Stefan Dösinger stefandoesinger@gmx.at:
Am 14.02.2017 um 22:01 schrieb Sebastian Lackner sebastian@fds-team.de:
While you are just at it, please note that this code also contains a leak when the exception is triggered. Actually, it would probably be easier to test if the pointer is writeable in advance, and exit early without creating the surface at all.
I wouldn’t be the least bit surprised if Windows leaked in this situation as well. But I guess for the test it is relevant for Valgrind runs.
A pre-emptive
__TRY { *surface = NULL; } __EXCEPT_PAGE_FAULT { return E_INVALIDARG; }
before doing any work would be nicer, if it doesn’t have any unexpected side effects (e.g. Windows might keep *surface alone in some error conditions, which wouldn’t surprise me either).
Alex, can you look into fixing the leak?
Yes, I'll look into it. Sorry for not noticing the leak before.
-Alex