]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr: release allocated PyString
authorKefu Chai <kchai@redhat.com>
Fri, 21 Apr 2017 14:36:18 +0000 (22:36 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 21 Apr 2017 14:36:34 +0000 (22:36 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/mgr/MgrPyModule.cc

index 4e4c42483a51b41223ce2fbad0186da1f03d79ce..e879c70e551b90a0470410fd6d8039638362e731 100644 (file)
@@ -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();
 }