summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-01-06 13:45:55 +0100
committerStefan Metzmacher <metze@samba.org>2011-01-06 14:34:31 +0100
commit2778130d45006a8cc04c11814070839e922bcc31 (patch)
treee972b0dc17fdad151a8c13acb747d4c2fb66a2ae
parentce7cb972b0ba7ec20d05bb1c4243fa0e2b5f05c0 (diff)
downloadsamba-2778130d45006a8cc04c11814070839e922bcc31.tar.gz
samba-2778130d45006a8cc04c11814070839e922bcc31.tar.bz2
samba-2778130d45006a8cc04c11814070839e922bcc31.zip
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
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm7
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 d6eab12c5c..7f6f94e748 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("");