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);
|
||||
if(config){
|
||||
liblex_result result = eval_config_free(config);
|
||||
free(config);
|
||||
if(result != LIBLEX_SUCCESS){
|
||||
PyErr_NoMemory();
|
||||
}
|
||||
|
@ -69,9 +70,10 @@ static int _pyliblex_add_match(void* data, va_list args){
|
|||
}
|
||||
|
||||
if(tuple) {
|
||||
if(return_code != 0) Py_DECREF(tuple);
|
||||
else return_code = PyList_Append(list, tuple);
|
||||
if(return_code == 0) return_code = PyList_Append(list, tuple);
|
||||
Py_DECREF(tuple);
|
||||
}
|
||||
|
||||
return return_code;
|
||||
}
|
||||
static PyObject* pyliblex_lex(PyObject* self, PyObject* args){
|
||||
|
|
Loading…
Reference in New Issue
Block a user