[Python] Fix memory leaks.
This commit is contained in:
parent
b671a37e89
commit
84ff84f4fb
3 changed files with 90 additions and 29 deletions
|
|
@ -95,8 +95,12 @@ SWIG_Python_RaiseOrModifyTypeError(const char *message)
|
|||
#else
|
||||
newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
|
||||
#endif
|
||||
Py_XDECREF(value);
|
||||
PyErr_Restore(type, newvalue, traceback);
|
||||
if (newvalue) {
|
||||
Py_XDECREF(value);
|
||||
PyErr_Restore(type, newvalue, traceback);
|
||||
} else {
|
||||
PyErr_Restore(type, value, traceback);
|
||||
}
|
||||
} else {
|
||||
/* Raise TypeError using given message */
|
||||
PyErr_SetString(PyExc_TypeError, message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue