Fix 8 memory leaks from bad PyList_Append use
This commit is contained in:
@@ -142,18 +142,12 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
PyObject *list = PyList_New(0);
|
||||
PyObject *item;
|
||||
for (unsigned int i = 0; i < self->uf1D_vectorviewshape->result.size(); i++) {
|
||||
|
||||
const unsigned int list_len = self->uf1D_vectorviewshape->result.size();
|
||||
PyObject *list = PyList_New(list_len);
|
||||
for (unsigned int i = 0; i < list_len; i++) {
|
||||
ViewShape *v = self->uf1D_vectorviewshape->result[i];
|
||||
if (v) {
|
||||
item = BPy_ViewShape_from_ViewShape(*v);
|
||||
}
|
||||
else {
|
||||
item = Py_None;
|
||||
Py_INCREF(item);
|
||||
}
|
||||
PyList_Append(list, item);
|
||||
PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None));
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
Reference in New Issue
Block a user