summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-17 19:00:31 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-17 20:45:38 +0200
commitd4172bbcc579fd446c252f2d7465275e3ee016b1 (patch)
treed608ce55de8e05e17752f33965928fc1ad671441
parentd558d8ab94874a6acc1ff0c843b47d5319099a84 (diff)
downloadsamba-d4172bbcc579fd446c252f2d7465275e3ee016b1.tar.gz
samba-d4172bbcc579fd446c252f2d7465275e3ee016b1.tar.bz2
samba-d4172bbcc579fd446c252f2d7465275e3ee016b1.zip
pycredentials: Fix memory leak.
-rw-r--r--source4/auth/credentials/pycredentials.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/auth/credentials/pycredentials.c b/source4/auth/credentials/pycredentials.c
index de5cc87194..3b11955538 100644
--- a/source4/auth/credentials/pycredentials.c
+++ b/source4/auth/credentials/pycredentials.c
@@ -38,7 +38,13 @@ static PyObject *PyString_FromStringOrNULL(const char *str)
static PyObject *py_creds_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- return py_talloc_import(type, cli_credentials_init(NULL));
+ py_talloc_Object *ret = (py_talloc_Object *)PyCredentials.tp_alloc(&PyCredentials, 0);
+ ret->talloc_ctx = talloc_new(NULL);
+ if (ret->talloc_ctx == NULL) {
+ return NULL;
+ }
+ ret->ptr = cli_credentials_init(ret->talloc_ctx);
+ return (PyObject *)ret;
}
static PyObject *py_creds_get_username(py_talloc_Object *self)