diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2010-09-22 15:35:36 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-09-22 17:48:23 -0700 |
commit | 3fea9df85a7d489b81e21a7a63f9e115de712d4c (patch) | |
tree | 07c31f8431ccc4e563922f1b7f56794e449e52c9 /source4/auth/pyauth.c | |
parent | 63031a2a78cff19f1f17137adfbc85a4df05ae36 (diff) | |
download | samba-3fea9df85a7d489b81e21a7a63f9e115de712d4c.tar.gz samba-3fea9df85a7d489b81e21a7a63f9e115de712d4c.tar.bz2 samba-3fea9df85a7d489b81e21a7a63f9e115de712d4c.zip |
s4-param: Check type when converting python object to lp_ctx, fix some
memory leaks.
Diffstat (limited to 'source4/auth/pyauth.c')
-rw-r--r-- | source4/auth/pyauth.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/auth/pyauth.c b/source4/auth/pyauth.c index dff696334c..a66411bb4a 100644 --- a/source4/auth/pyauth.c +++ b/source4/auth/pyauth.c @@ -46,12 +46,14 @@ static PyObject *py_system_session(PyObject *module, PyObject *args) if (!PyArg_ParseTuple(args, "|O", &py_lp_ctx)) return NULL; - lp_ctx = lpcfg_from_py_object(NULL, py_lp_ctx); /* FIXME: Leaks memory */ + lp_ctx = lpcfg_from_py_object(NULL, py_lp_ctx); if (lp_ctx == NULL) return NULL; session = system_session(lp_ctx); + talloc_free(lp_ctx); + return PyAuthSession_FromSession(session); } @@ -66,13 +68,15 @@ static PyObject *py_admin_session(PyObject *module, PyObject *args) if (!PyArg_ParseTuple(args, "OO", &py_lp_ctx, &py_sid)) return NULL; - lp_ctx = lpcfg_from_py_object(NULL, py_lp_ctx); /* FIXME: leaky */ + lp_ctx = lpcfg_from_py_object(NULL, py_lp_ctx); if (lp_ctx == NULL) return NULL; domain_sid = dom_sid_parse_talloc(NULL, PyString_AsString(py_sid)); session = admin_session(NULL, lp_ctx, domain_sid); + talloc_free(lp_ctx); + return PyAuthSession_FromSession(session); } |