From f573177c352c2df89c7d5ffd425a37b46b12166c Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Mon, 24 Apr 2023 10:42:39 +1200 Subject: [PATCH] python: Safely clear structure members Using Py_CLEAR() ensures that these structures are observed in a consistent state by any Python code that may run during deconstruction. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett Reference:https://github.com/samba-team/samba/commit/f573177c352c2df89c7d5ffd425a37b46b12166c Conflict:only change pytdb.c, other files do not belong to the libtdb package. --- pytdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytdb.c b/pytdb.c index e2f8ace..d47d933 100644 --- a/pytdb.c +++ b/pytdb.c @@ -474,7 +474,7 @@ static PyObject *tdb_iter_next(PyTdbIteratorObject *self) static void tdb_iter_dealloc(PyTdbIteratorObject *self) { - Py_DECREF(self->iteratee); + Py_CLEAR(self->iteratee); PyObject_Del(self); } -- 2.33.0