From 19e0ecbb9d09fbf4bdc8138e9984673ec52f48fb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 3 Dec 2021 03:38:04 +0100 Subject: [PATCH] Don't leak the pointer returned by SWIG_CException::get_pending() This pointer is always new (if non-null) and so must be deleted. --- Source/Modules/c.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Modules/c.cxx b/Source/Modules/c.cxx index 0cd47b5e1..16424b400 100644 --- a/Source/Modules/c.cxx +++ b/Source/Modules/c.cxx @@ -271,6 +271,7 @@ struct cxx_wrappers "inline void swig_check() {\n", cindent, "if (SWIG_CException* swig_ex = SWIG_CException::get_pending()) {\n", cindent, cindent, "SWIG_CException swig_ex_copy{*swig_ex};\n", + cindent, cindent, "delete swig_ex;\n", cindent, cindent, "SWIG_CException::reset_pending();\n", cindent, cindent, "throw swig_ex_copy;\n", cindent, "}\n",