Skip to content

Small UB in "Complete code for DDSTextureLoader" Page #5075

Closed
@rnvannatta

Description

@rnvannatta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions