Removed bug of double free corruption that was an attempt to fix memory leak

This commit is contained in:
Anne de Jong 2022-05-17 14:58:12 +02:00
parent d51d3f7d37
commit 95c1a194fa

View File

@ -87,12 +87,12 @@ static inline PyObject *data_to_ndarray(void *data, int n_rows, int n_cols,
// https://stackoverflow.com/questions/54269956/crash-of-jupyter-due-to-the-use-of-pyarray-enableflags/54278170#54278170
// Note that in general it was disadvised to build all C code with MinGW on
// Windows. We do it anyway, see if we find any problems on the way.
PyObject *capsule = PyCapsule_New(data, LASP_CAPSULE_NAME, capsule_cleanup);
int res = PyArray_SetBaseObject(arr, capsule);
if (res != 0) {
fprintf(stderr, "Failed to set base object of array!");
return NULL;
}
/* PyObject *capsule = PyCapsule_New(data, LASP_CAPSULE_NAME, capsule_cleanup); */
/* int res = PyArray_SetBaseObject(arr, capsule); */
/* if (res != 0) { */
/* fprintf(stderr, "Failed to set base object of array!"); */
/* return NULL; */
/* } */
PyArray_ENABLEFLAGS(arr, NPY_OWNDATA);
}