jingwood / d2dlib

A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
MIT License
234 stars 40 forks source link

CreateTextLayout causes Memory Leak #79

Closed MightyM7 closed 2 years ago

MightyM7 commented 2 years ago

Hi,

the function CreateTextLayout in Text.cpp causes a memory leak by not releasing the textFormat in case of returning the textLayout (line 87).

Old:

if (SUCCEEDED(hr) && textLayout != NULL) { return (HANDLE)textLayout; }

Correct:

if (SUCCEEDED(hr) && textLayout != NULL) { SafeRelease(&textFormat); return (HANDLE)textLayout; }

Regards

jingwood commented 2 years ago

Thanks!