diff options
author | Christoph Gohlke <cgohlke@uci.edu> | 2021-05-13 13:45:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 13:45:23 -0700 |
commit | 853dba482e6e71d3763a005b70dfd95d8857dddc (patch) | |
tree | 1b04b12e5adca462c9a6e075aacc82f78062fe46 /numpy | |
parent | fb4ea911607a81ef6633b857122e34229075705e (diff) | |
download | numpy-853dba482e6e71d3763a005b70dfd95d8857dddc.tar.gz |
BUG: fix potential use of null pointer
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/nditer_constr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/core/src/multiarray/nditer_constr.c b/numpy/core/src/multiarray/nditer_constr.c index 2197fe798..a0154e474 100644 --- a/numpy/core/src/multiarray/nditer_constr.c +++ b/numpy/core/src/multiarray/nditer_constr.c @@ -594,8 +594,10 @@ NpyIter_Copy(NpyIter *iter) if (buffers[iop] == NULL) { out_of_memory = 1; } - if (PyDataType_FLAGCHK(dtypes[iop], NPY_NEEDS_INIT)) { - memset(buffers[iop], '\0', itemsize*buffersize); + else { + if (PyDataType_FLAGCHK(dtypes[iop], NPY_NEEDS_INIT)) { + memset(buffers[iop], '\0', itemsize*buffersize); + } } } } |