diff options
| author | mattip <matti.picus@gmail.com> | 2019-01-20 10:18:09 +0200 |
|---|---|---|
| committer | mattip <matti.picus@gmail.com> | 2019-01-20 16:28:35 +0200 |
| commit | adfaafba9f45cea66a344d0d67916bee38b79ce2 (patch) | |
| tree | 3b499e191efa20cc752ad2c1e11bb763dc8181e8 /numpy/core/src | |
| parent | f07a38da97a6a36eb12b203f6c1ffa4bf2b2cb87 (diff) | |
| download | numpy-adfaafba9f45cea66a344d0d67916bee38b79ce2.tar.gz | |
BUG: double decref of dtype in failure codepath. Test and fix
Diffstat (limited to 'numpy/core/src')
| -rw-r--r-- | numpy/core/src/multiarray/ctors.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index 23a8dcea2..259ee9aac 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -2495,6 +2495,11 @@ PyArray_FromInterface(PyObject *origin) &PyArray_Type, dtype, n, dims, NULL, data, dataflags, NULL, base); + /* + * Ref to dtype was stolen by PyArray_NewFromDescrAndBase + * Prevent DECREFing dtype in fail codepath by setting to NULL + */ + dtype = NULL; if (ret == NULL) { goto fail; } |
