Details
-
Bug
-
Resolution: Fixed
-
Major
-
4.0.0, 4.0.1, 4.0.2
-
None
-
None
-
1
Description
When building the KV error map, build_kv_error_map_info(), creates two memory leaks by adding strings directly to the err_info dict using the PyDict_SetItemString().
To fix the leak:
- created a PyObject* that stores the string
- add the created PyObject* to the err_info dict
- decrement the created PyObject* after it has been added to the dict
Leak:
if (-1 == PyDict_SetItemString(err_info, "name", PyUnicode_FromString(error_info.name.c_str()))) { |
PyErr_Print();
|
PyErr_Clear();
|
}
|
if (-1 == PyDict_SetItemString(err_info, "description", PyUnicode_FromString(error_info.description.c_str()))) { |
PyErr_Print();
|
PyErr_Clear();
|
}
|
Also, call tp_free() in the exception_base destructor (see associated ticket PYCBC-1382).
Attachments
Issue Links
- relates to
-
PYCBC-1382 Custom Python types should call tp_free in their destructor
- Resolved