Skip to content

Commit 54469e2

Browse files
authored
Merge pull request numpy#25931 from ngoldbaum/fix-refcnt-leak
BUG: fix reference leak in PyArray_FromArrayAttr_int
2 parents 8ed37a6 + 01eec27 commit 54469e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

numpy/_core/src/multiarray/ctors.c

+4
Original file line numberDiff line numberDiff line change
@@ -2481,6 +2481,7 @@ PyArray_FromArrayAttr_int(
24812481
"__array__ should implement 'dtype' and "
24822482
"'copy' keywords", 1) < 0) {
24832483
Py_DECREF(str_value);
2484+
Py_DECREF(args);
24842485
Py_DECREF(kwargs);
24852486
return NULL;
24862487
}
@@ -2489,6 +2490,7 @@ PyArray_FromArrayAttr_int(
24892490
new = PyObject_Call(array_meth, args, kwargs);
24902491
if (new == NULL) {
24912492
Py_DECREF(str_value);
2493+
Py_DECREF(args);
24922494
Py_DECREF(kwargs);
24932495
return NULL;
24942496
}
@@ -2498,11 +2500,13 @@ PyArray_FromArrayAttr_int(
24982500
}
24992501
if (new == NULL) {
25002502
PyErr_Restore(type, value, traceback);
2503+
Py_DECREF(args);
25012504
Py_DECREF(kwargs);
25022505
return NULL;
25032506
}
25042507
}
25052508

2509+
Py_DECREF(args);
25062510
Py_DECREF(kwargs);
25072511
Py_DECREF(array_meth);
25082512

0 commit comments

Comments
 (0)