From: Joseph Sutton Date: Mon, 31 Jul 2023 21:56:49 +0000 (+1200) Subject: ldb: Don’t decrement reference count until object is no longer needed X-Git-Tag: tevent-0.16.0~1185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=41e0951d915ad5cf660ca227be2f4c844dcbdf8e;p=thirdparty%2Fsamba.git ldb: Don’t decrement reference count until object is no longer needed If ‘tmp’ happens to be garbage-collected, ‘name’ will become invalid. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 6215efb3d4d..8db6ccb8bc1 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -4363,10 +4363,10 @@ static PyObject *py_register_module(PyObject *module, PyObject *args) TALLOC_FREE(ops); return NULL; } - Py_XDECREF(tmp); Py_INCREF(input); ops->name = talloc_strdup(ops, name); + Py_XDECREF(tmp); ops->private_data = input; ops->init_context = py_module_init; ops->search = py_module_search;