Skip to content

Commit 47ae786

Browse files
neutrinocerosrgommers
authored andcommitted
BUG: add missing checks for nullptr in INIT and INIT_ONE macros
1 parent 95eb7f3 commit 47ae786

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

bottleneck/src/move_template.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#define INIT(dtype) \
2222
PyObject *y = PyArray_EMPTY(PyArray_NDIM(a), PyArray_SHAPE(a), dtype, 0); \
23+
if (y == NULL) return NULL; \
2324
iter2 it; \
2425
init_iter2(&it, a, y, axis);
2526

bottleneck/src/reduce_template.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
npy_##dtype1 *py; \
3030
init_iter_one(&it, a, axis); \
3131
y = PyArray_EMPTY(NDIM - 1, SHAPE, NPY_##dtype0, 0); \
32+
if (y == NULL) return NULL; \
3233
py = (npy_##dtype1 *)PyArray_DATA((PyArrayObject *)y);
3334

3435
/* function signatures --------------------------------------------------- */

0 commit comments

Comments
 (0)