From cb51cc7ce886c4dee6320d9aca0e2865ba927045 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 10 Oct 2023 14:16:04 +1100 Subject: [PATCH] Fix OpenEXR leak, failure to close a file when BLI_mmap_open fails --- source/blender/imbuf/intern/openexr/openexr_api.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 1583d271aa5..05ff1c44aab 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -162,10 +162,10 @@ class IMMapStream : public Imf::IStream { imb_mmap_lock(); _mmap_file = BLI_mmap_open(file); imb_mmap_unlock(); + close(file); if (_mmap_file == nullptr) { throw IEX_NAMESPACE::InputExc("BLI_mmap_open failed"); } - close(file); _exrbuf = (uchar *)BLI_mmap_get_pointer(_mmap_file); }