ManagedTexture: fix file buffer leak on failed image decode

TextureLoadTask::Run() only freed the VFS-read file buffer on the
success path - a corrupt/truncated image in a texture pack or
replacement texture directory (valid magic, bad payload) leaked the
whole file's bytes on every load attempt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L4QAoxV2KY7ek4PcZw3WvY
This commit is contained in:
Henrik RydgårdandClaude Sonnet 5 committed 2026-08-09 21:31:22 +02:00
1 parent 472ff6ac71
commit ef87fe2e74
1 file changed
+2 -6
+2 -6
View File
@@ -40,13 +40,9 @@ public:
return;
}
if (!tempImage_->LoadTextureLevelsFromFileData(buffer, fileSize, type_)) {
*state_ = ManagedTexture::LoadState::FAILED;
waitable_->Notify();
return;
}
bool success = tempImage_->LoadTextureLevelsFromFileData(buffer, fileSize, type_);
delete[] buffer;
*state_ = ManagedTexture::LoadState::SUCCESS;
*state_ = success ? ManagedTexture::LoadState::SUCCESS : ManagedTexture::LoadState::FAILED;
waitable_->Notify();
}