From 70e5adacf069070c8cb968726cb185c1a63acd39 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Mon, 21 Jan 2019 17:31:08 +0100 Subject: [PATCH] Fix memory leak. --- src/CMakeLists.txt | 2 +- src/Errors.cxx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c0d911d..0b05a4c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,7 @@ ADD_LIBRARY(py2cpp ${_py2cpp_sources}) TARGET_LINK_LIBRARIES(py2cpp ${_link_LIBRARIES}) TARGET_INCLUDE_DIRECTORIES(py2cpp PUBLIC $ - $) + $) INSTALL(TARGETS py2cpp EXPORT FindPy2cpp LIBRARY DESTINATION lib) INSTALL(FILES ${_py2cpp_headers} DESTINATION include/py2cpp) diff --git a/src/Errors.cxx b/src/Errors.cxx index dfafa5c..d6b0d59 100644 --- a/src/Errors.cxx +++ b/src/Errors.cxx @@ -105,6 +105,7 @@ void ConversionCheck::addError(const std::string& expectedType, PyObject * obj) pyRepr = PyUnicode_AsUTF8(pyResult); else pyRepr = "unknown representation"; + Py_XDECREF(pyResult); if(pyRepr.size() > 80) { pyRepr = pyRepr.substr(0, 76); -- 2.39.2