diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-01-06 13:45:55 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-01-06 14:34:31 +0100 |
commit | 2778130d45006a8cc04c11814070839e922bcc31 (patch) | |
tree | e972b0dc17fdad151a8c13acb747d4c2fb66a2ae /pidl | |
parent | ce7cb972b0ba7ec20d05bb1c4243fa0e2b5f05c0 (diff) | |
download | samba-2778130d45006a8cc04c11814070839e922bcc31.tar.gz |
pidl:Samba4/Python: fix memory leak in _ndr_print functions
metze
Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Jan 6 14:34:31 CET 2011 on sn-devel-104
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/lib/Parse/Pidl/Samba4/Python.pm | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index d6eab12c5c0..7f6f94e7481 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -297,9 +297,14 @@ sub PythonStruct($$$$$$) $self->pidl("{"); $self->indent; $self->pidl("$cname *object = ($cname *)py_talloc_get_ptr(py_obj);"); + $self->pidl("PyObject *ret;"); $self->pidl("char *retstr;"); + $self->pidl(""); $self->pidl("retstr = ndr_print_struct_string(py_talloc_get_mem_ctx(py_obj), (ndr_print_fn_t)ndr_print_$name, \"$name\", object);"); - $self->pidl("return PyString_FromString(retstr);"); + $self->pidl("ret = PyString_FromString(retstr);"); + $self->pidl("talloc_free(retstr);"); + $self->pidl(""); + $self->pidl("return ret;"); $self->deindent; $self->pidl("}"); $self->pidl(""); |