summaryrefslogtreecommitdiff
path: root/pidl/lib/Parse/Pidl/Samba4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-09-20 21:02:16 -0700
committerJelmer Vernooij <jelmer@samba.org>2010-09-20 22:40:47 -0700
commitc4c6f8f1755486056f77b9a7f830d10a9ebfb7b0 (patch)
tree88ec09f296699e36bfd946bd21547bdbcd5bdaf9 /pidl/lib/Parse/Pidl/Samba4
parentf161fa3ac8e437600e64354652114e99edac32bb (diff)
downloadsamba-c4c6f8f1755486056f77b9a7f830d10a9ebfb7b0.tar.gz
samba-c4c6f8f1755486056f77b9a7f830d10a9ebfb7b0.tar.bz2
samba-c4c6f8f1755486056f77b9a7f830d10a9ebfb7b0.zip
s4-pild-python: Fix assignments - even though we reference the mem_ctx
of an object we still use the actual ptr.
Diffstat (limited to 'pidl/lib/Parse/Pidl/Samba4')
-rw-r--r--pidl/lib/Parse/Pidl/Samba4/Python.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 2c42b0a874..d4db4c0834 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -832,7 +832,7 @@ sub assign($$$)
if ($dest =~ /^\&/ and $src eq "NULL") {
$self->pidl("memset($dest, 0, sizeof(" . get_value_of($dest) . "));");
} elsif ($dest =~ /^\&/) {
- $self->pidl("memcpy($dest, $src, sizeof(" . get_value_of($dest) . "));");
+ $self->pidl("memmove($dest, $src, sizeof(" . get_value_of($dest) . "));");
} else {
$self->pidl("$dest = $src;");
}
@@ -894,7 +894,13 @@ sub ConvertObjectFromPythonData($$$$$$;$)
return;
}
$self->pidl("PY_CHECK_TYPE($ctype_name, $cvar, $fail);");
- $self->assign($target, "talloc_reference($mem_ctx, (".mapTypeName($ctype)." *)py_talloc_get_mem_ctx($cvar))");
+ $self->pidl("if (talloc_reference($mem_ctx, py_talloc_get_mem_ctx($cvar)) == NULL) {");
+ $self->indent;
+ $self->pidl("PyErr_NoMemory();");
+ $self->pidl("$fail");
+ $self->deindent;
+ $self->pidl("}");
+ $self->assign($target, "(".mapTypeName($ctype)." *)py_talloc_get_ptr($cvar)");
return;
}