Fix memory leaks remaining in code.
This commit is contained in:
parent
46f52665cb
commit
9eb13b0ca8
|
@ -6,6 +6,7 @@ static void _pyliblex_free_eval(PyObject* object){
|
||||||
eval_config* config = PyCapsule_GetPointer(object, NULL);
|
eval_config* config = PyCapsule_GetPointer(object, NULL);
|
||||||
if(config){
|
if(config){
|
||||||
liblex_result result = eval_config_free(config);
|
liblex_result result = eval_config_free(config);
|
||||||
|
free(config);
|
||||||
if(result != LIBLEX_SUCCESS){
|
if(result != LIBLEX_SUCCESS){
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
}
|
}
|
||||||
|
@ -69,9 +70,10 @@ static int _pyliblex_add_match(void* data, va_list args){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tuple) {
|
if(tuple) {
|
||||||
if(return_code != 0) Py_DECREF(tuple);
|
if(return_code == 0) return_code = PyList_Append(list, tuple);
|
||||||
else return_code = PyList_Append(list, tuple);
|
Py_DECREF(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
return return_code;
|
return return_code;
|
||||||
}
|
}
|
||||||
static PyObject* pyliblex_lex(PyObject* self, PyObject* args){
|
static PyObject* pyliblex_lex(PyObject* self, PyObject* args){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user