Skip to content

Commit

Permalink
Merge pull request #3124 from njsmith/backport-2976
Browse files Browse the repository at this point in the history
BUG: PyArray_LexSort allocates too much temporary memory.
  • Loading branch information
certik committed Mar 7, 2013
2 parents 1720bb8 + f781708 commit 6fc5018
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions numpy/core/src/multiarray/item_selection.c
Expand Up @@ -1288,11 +1288,11 @@ PyArray_LexSort(PyObject *sort_keys, int axis)
"need sequence of keys with len > 0 in lexsort");
return NULL;
}
mps = (PyArrayObject **) PyArray_malloc(n*NPY_SIZEOF_PYARRAYOBJECT);
mps = (PyArrayObject **) PyArray_malloc(n * sizeof(PyArrayObject *));
if (mps == NULL) {
return PyErr_NoMemory();
}
its = (PyArrayIterObject **) PyArray_malloc(n*sizeof(PyArrayIterObject));
its = (PyArrayIterObject **) PyArray_malloc(n * sizeof(PyArrayIterObject *));
if (its == NULL) {
PyArray_free(mps);
return PyErr_NoMemory();
Expand Down

0 comments on commit 6fc5018

Please sign in to comment.