From 2d386d87da99b2e8b390a03bdd390c38f95aceb0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 26 Jan 2023 17:44:59 +0530 Subject: [PATCH] free more carefully making sure we dont double free --- src/calibre/utils/cpp_binding.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/cpp_binding.h b/src/calibre/utils/cpp_binding.h index 58b130a1bb..31bbc1dcd5 100644 --- a/src/calibre/utils/cpp_binding.h +++ b/src/calibre/utils/cpp_binding.h @@ -32,8 +32,9 @@ class generic_raii { void release() noexcept { if (handle != null) { - free_T(handle); + T temp = handle; handle = null; + free_T(temp); } }