summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-24 23:17:51 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-24 23:17:51 +0200
commit4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc (patch)
tree91bbba83dc90a7d8c6847b8cf8ec124f07359d09 /pidl/lib/Parse/Pidl/Samba4
parent7e49a58ab9a66a709ee2a15d40db7c59bf55cbac (diff)
downloadsamba-4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc.tar.gz
samba-4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc.tar.bz2
samba-4a75cb9cd5dfdd347803d03acbc0533c2e7e89cc.zip
pidl/python: Increment reference counter on Py_None to prevent us from
accidentally deallocating it.
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 390ee27510..4fb8f6be2c 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -126,6 +126,7 @@ sub FromUnionToPythonFunction($$$$)
$self->ConvertObjectToPython($mem_ctx, {}, $e, "$name->$e->{NAME}", "ret", "return NULL;");
} else {
$self->pidl("ret = Py_None;");
+ $self->pidl("Py_INCREF(ret);");
}
$self->pidl("return ret;");
@@ -1052,6 +1053,7 @@ sub ConvertObjectToPythonLevel($$$$$$)
$self->pidl("if ($var_name == NULL) {");
$self->indent;
$self->pidl("$py_var = Py_None;");
+ $self->pidl("Py_INCREF($py_var);");
$self->deindent;
$self->pidl("} else {");
$self->indent;