summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2019-01-22 18:26:23 +0000
committerNoel Power <npower@samba.org>2019-02-07 13:44:30 +0100
commita8e10a12493fdb6b8347b14e157aeb619cf2d2da (patch)
treefce0edcc38dd3b827744708ec748d306c84512e1 /auth
parentbf91ee0a9727cc392583fe84ad069204be758515 (diff)
downloadsamba-a8e10a12493fdb6b8347b14e157aeb619cf2d2da.tar.gz
Decrement references to python objects passed to Py_BuildValue
Py_BuildValue when processing format 'O' will 'Pass a Python object untouched (except for its reference count, which is incremented by one' Basically this means if you are using a new reference to a PyObject to pass to BuildValue (to be used with the 'O' format) the reference *isn't* stolen so you really do need to DECREF it in order to ensure it gets cleaned up. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'auth')
-rw-r--r--auth/credentials/pycredentials.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/auth/credentials/pycredentials.c b/auth/credentials/pycredentials.c
index d1ee12e45a9..1b86e001557 100644
--- a/auth/credentials/pycredentials.c
+++ b/auth/credentials/pycredentials.c
@@ -75,9 +75,10 @@ static PyObject *py_creds_get_ntlm_username_domain(PyObject *self, PyObject *unu
PyObject *ret = NULL;
cli_credentials_get_ntlm_username_domain(PyCredentials_AsCliCredentials(self),
frame, &user, &domain);
- ret = Py_BuildValue("(OO)",
- PyString_FromStringOrNULL(user),
- PyString_FromStringOrNULL(domain));
+ ret = Py_BuildValue("(ss)",
+ user,
+ domain);
+
TALLOC_FREE(frame);
return ret;
}