mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
param/python: Fix memory leak of LoadParm objects.
This commit is contained in:
parent
7b8fcacda2
commit
28a2c262ac
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user