Skip to content

Commit

Permalink
tr2/level: fix crash when freeing 16-bit textures
Browse files Browse the repository at this point in the history
Regression from ba2d5b2.
  • Loading branch information
rr- committed Feb 1, 2025
1 parent 3a5fe66 commit 4b91ef1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libtrx/game/level/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ void Level_ReadTexturePages(
const int32_t texture_size_16_bit =
num_pages * TEXTURE_PAGE_SIZE * sizeof(uint16_t);
uint16_t *input = Memory_Alloc(texture_size_16_bit);
uint16_t *input_ptr = input;
VFile_Read(file, input, texture_size_16_bit);
for (int32_t i = 0; i < num_pages * TEXTURE_PAGE_SIZE; i++) {
*output++ = M_ARGB1555To8888(*input++);
*output++ = M_ARGB1555To8888(*input_ptr++);
}
Memory_FreePointer(&input);
#endif
Expand Down

0 comments on commit 4b91ef1

Please sign in to comment.