Skip to content

Commit

Permalink
Fix memory leak. (#991)
Browse files Browse the repository at this point in the history
Fixes #990.
  • Loading branch information
MarkCallow authored Mar 6, 2025
1 parent 8edc880 commit e0cf193
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/basis_transcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@ ktxTexture2_transcodeLzEtc1s(ktxTexture2* This,
uint32_t& imageCount = firstImages[This->numLevels];

if (BGD_TABLES_ADDR(0, bgdh, imageCount) + bgdh.tablesByteLength > priv._sgdByteLength) {
// Compiler will not allow `goto cleanup;` because "jump bypasses variable initialization."
// The static initializations below this and before the loop are presumably the issue
// as the compiler is,presumably, inserting code to destruct those at the end of the
// function.
delete[] firstImages;
return KTX_FILE_DATA_ERROR;
}
// FIXME: Do more validation.
Expand Down

0 comments on commit e0cf193

Please sign in to comment.