From d4172bbcc579fd446c252f2d7465275e3ee016b1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 17 Jun 2009 19:00:31 +0200 Subject: pycredentials: Fix memory leak. --- source4/auth/credentials/pycredentials.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit