From c4c6f8f1755486056f77b9a7f830d10a9ebfb7b0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 20 Sep 2010 21:02:16 -0700 Subject: s4-pild-python: Fix assignments - even though we reference the mem_ctx of an object we still use the actual ptr. --- pidl/lib/Parse/Pidl/Samba4/Python.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pidl') 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; } -- cgit