summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-17 19:07:44 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-17 20:45:38 +0200
commit28a2c262acf47a4a1f170375ea5e709a31a61ff4 (patch)
tree80507cf566980770120f7a725795d6e844aafcc4 /source4/param
parent7b8fcacda29954c585746c255598b9b180e56e1f (diff)
downloadsamba-28a2c262acf47a4a1f170375ea5e709a31a61ff4.tar.gz
samba-28a2c262acf47a4a1f170375ea5e709a31a61ff4.tar.bz2
samba-28a2c262acf47a4a1f170375ea5e709a31a61ff4.zip
param/python: Fix memory leak of LoadParm objects.
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/pyparam.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 4f6e2fff49..8786ab67bb 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -295,7 +295,18 @@ static PyGetSetDef py_lp_ctx_getset[] = {
static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
- return py_talloc_import(type, loadparm_init(NULL));
+ py_talloc_Object *ret = (py_talloc_Object *)type->tp_alloc(type, 0);
+ if (ret == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ ret->talloc_ctx = talloc_new(NULL);
+ if (ret->talloc_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+ ret->ptr = loadparm_init(ret->talloc_ctx);
+ return (PyObject *)ret;
}
static Py_ssize_t py_lp_ctx_len(py_talloc_Object *self)