MicrosoftDocs/windows-dev-docs

Small UB in "Complete code for DDSTextureLoader" Page

Closed this issue · 0 comments

Type of issue

Code doesn't work

Feedback

There's a small typo causing undefined behavior in the DDSTextureLoader page, source markdown here, the line
std::unique_ptr<D3D11_SUBRESOURCE_DATA> initData(new D3D11_SUBRESOURCE_DATA[mipCount * arraySize]);
needs to be
std::unique_ptr<D3D11_SUBRESOURCE_DATA[]> initData(new D3D11_SUBRESOURCE_DATA[mipCount * arraySize]);
to call the correct delete[] operator.

This has been fixed in the github repo this article is sourced from. It might be better to just offer a link to that github repo?

My apologies for not using the issue template, I could not find a link to the template on the page.