Fix memory leak on error paths in tinyexr loader

(cherry picked from commit f912a5aa56)
This commit is contained in:
Alistair Leslie-Hughes 2023-11-17 09:52:23 +11:00 committed by Rémi Verschelde
parent 90f7b2b8cf
commit 779414c1e8
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 2 additions and 0 deletions

View File

@ -68,6 +68,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitF
if (ret != TINYEXR_SUCCESS) { if (ret != TINYEXR_SUCCESS) {
if (err) { if (err) {
ERR_PRINT(String(err)); ERR_PRINT(String(err));
FreeEXRErrorMessage(err);
} }
return ERR_FILE_CORRUPT; return ERR_FILE_CORRUPT;
} }
@ -86,6 +87,7 @@ Error ImageLoaderTinyEXR::load_image(Ref<Image> p_image, Ref<FileAccess> f, BitF
if (ret != TINYEXR_SUCCESS) { if (ret != TINYEXR_SUCCESS) {
if (err) { if (err) {
ERR_PRINT(String(err)); ERR_PRINT(String(err));
FreeEXRErrorMessage(err);
} }
return ERR_FILE_CORRUPT; return ERR_FILE_CORRUPT;
} }