From 2005ce83adc8f321af97e813810ad30629956a3b Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 21 Apr 2017 22:36:18 +0800 Subject: [PATCH] mgr: release allocated PyString Signed-off-by: Kefu Chai --- src/mgr/MgrPyModule.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mgr/MgrPyModule.cc b/src/mgr/MgrPyModule.cc index 4e4c42483a5..e879c70e551 100644 --- a/src/mgr/MgrPyModule.cc +++ b/src/mgr/MgrPyModule.cc @@ -61,13 +61,14 @@ int MgrPyModule::load() auto pyHandle = PyString_FromString(module_name.c_str()); auto pArgs = PyTuple_Pack(1, pyHandle); pClassInstance = PyObject_CallObject(pClass, pArgs); + Py_DECREF(pyHandle); + Py_DECREF(pArgs); if (pClassInstance == nullptr) { derr << "Failed to construct class in '" << module_name << "'" << dendl; return -EINVAL; } else { dout(1) << "Constructed class from module: " << module_name << dendl; } - Py_DECREF(pArgs); return load_commands(); } -- 2.47.3