Merge branch 'memory_leak__nr_1' of https://github.com/Luflosi/kitty
This commit is contained in:
commit
8df9ccc72c
@ -206,7 +206,7 @@ match(PyObject *self, PyObject *args) {
|
||||
char **clines = malloc(sizeof(char*) * num_lines);
|
||||
if (!clines) { return PyErr_NoMemory(); }
|
||||
size_t *sizes = malloc(sizeof(size_t) * num_lines);
|
||||
if (!sizes) { return PyErr_NoMemory(); }
|
||||
if (!sizes) { free(clines); clines = NULL; return PyErr_NoMemory(); }
|
||||
for (size_t i = 0; i < num_lines; i++) {
|
||||
clines[i] = PyBytes_AS_STRING(PyList_GET_ITEM(lines, i));
|
||||
sizes[i] = PyBytes_GET_SIZE(PyList_GET_ITEM(lines, i));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user