Skip to content

Memory leaks #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions numpy/core/src/multiarray/multiarray_tests.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ static int copy_@type@(PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *ni
ptr += 1;
}

Py_INCREF(aout);
PyList_Append(*out, (PyObject*)aout);
Py_DECREF(aout);
PyArray_ITER_NEXT(itx);
Expand Down Expand Up @@ -84,7 +83,6 @@ static int copy_object(PyArrayIterObject *itx, PyArrayNeighborhoodIterObject *ni
PyArrayNeighborhoodIter_Next(niterx);
}

Py_INCREF(aout);
PyList_Append(*out, (PyObject*)aout);
Py_DECREF(aout);
PyArray_ITER_NEXT(itx);
Expand Down Expand Up @@ -238,7 +236,6 @@ copy_double_double(PyArrayNeighborhoodIterObject *itx,
ptr += 1;
PyArrayNeighborhoodIter_Next(niterx);
}
Py_INCREF(aout);
PyList_Append(*out, (PyObject*)aout);
Py_DECREF(aout);
PyArrayNeighborhoodIter_Next(itx);
Expand Down
1 change: 1 addition & 0 deletions numpy/core/src/umath/ufunc_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -4466,6 +4466,7 @@ PyUFunc_FromFuncAndDataAndSignature(PyUFuncGenericFunction *func, void **data,
self->core_signature = NULL;
if (signature != NULL) {
if (_parse_signature(self, signature) != 0) {
Py_DECREF(self);
return NULL;
}
}
Expand Down
1 change: 1 addition & 0 deletions numpy/core/src/umath/umath_tests.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ UMath_Tests_test_signature(PyObject *NPY_UNUSED(dummy), PyObject *args)
}
if (f == NULL) return NULL;
core_enabled = ((PyUFuncObject*)f)->core_enabled;
Py_DECREF(f);
return Py_BuildValue("i", core_enabled);
}

Expand Down
4 changes: 3 additions & 1 deletion numpy/core/src/umath/umathmodule.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS
fname_len = 1;
PyErr_Clear();
}
Py_XDECREF(pyname);

/*
* self->ptr holds a pointer for enough memory for
Expand All @@ -119,6 +118,7 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS
self->ptr = _pya_malloc(offset[0] + offset[1] + sizeof(void *) +
(fname_len + 14));
if (self->ptr == NULL) {
Py_XDECREF(pyname);
return PyErr_NoMemory();
}
Py_INCREF(function);
Expand All @@ -139,6 +139,8 @@ ufunc_frompyfunc(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject *NPY_UNUS
memcpy(str+fname_len, " (vectorized)", 14);
self->name = str;

Py_XDECREF(pyname);

/* Do a better job someday */
self->doc = "dynamic ufunc based on a python function";

Expand Down
4 changes: 3 additions & 1 deletion numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ static PyObject *f2py_rout_wrap_call(PyObject *capi_self,
dims[i] = (npy_intp)PyInt_AsLong(PySequence_GetItem(dims_capi,i));

capi_arr_tmp = array_from_pyobj(type_num,dims,rank,intent|F2PY_INTENT_OUT,arr_capi);
if (capi_arr_tmp == NULL)
if (capi_arr_tmp == NULL) {
free(dims);
return NULL;
}
capi_buildvalue = Py_BuildValue("N",capi_arr_tmp);
free(dims);
return capi_buildvalue;
Expand Down