libtdb/backport-python-Safely-clear-structure-members.patch
wangjiang 2250c150a4 Do not pass non-null terminated string to strcmp() and Safely clear structure members
(cherry picked from commit b59ea43acdbe3234f980385b4e147e29c4022a78)
2024-05-09 09:48:19 +08:00

34 lines
1.0 KiB
Diff

From f573177c352c2df89c7d5ffd425a37b46b12166c Mon Sep 17 00:00:00 2001
From: Joseph Sutton <josephsutton@catalyst.net.nz>
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 <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
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