From 2ecef38c8629e9a27613e646c4f01b5c0a0a566f Mon Sep 17 00:00:00 2001
From: Py_FindObjects
Date: Tue, 28 Nov 2023 17:33:35 +0800
Subject: [PATCH] MAINT: Fix use-after-free bug in Py_FindObject
 
---
 scipy/ndimage/src/nd_image.c | 1 -
 1 file changed, 1 deletion(-)
 
diff --git a/scipy/ndimage/src/nd_image.c b/scipy/ndimage/src/nd_image.c
index 9f3aed3..d9fcc57 100644
--- a/scipy/ndimage/src/nd_image.c
+++ b/scipy/ndimage/src/nd_image.c
@@ -928,7 +928,6 @@ static PyObject *Py_FindObjects(PyObject *obj, PyObject *args)
     Py_XDECREF(slc);
     free(regions);
     if (PyErr_Occurred()) {
-        Py_XDECREF(result);
         return NULL;
     } else {
         return result;
-- 
2.27.0
 