pidl:Samba4/Python: fix segfault when setting pointers to scalars.
authorStefan Metzmacher <metze@samba.org>
Wed, 5 Jan 2011 09:05:47 +0000 (10:05 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 5 Jan 2011 09:24:49 +0000 (10:24 +0100)
metze

pidl/lib/Parse/Pidl/Samba4/Python.pm

index 60352ae..fa18056 100644 (file)
@@ -1000,6 +1000,9 @@ sub ConvertObjectFromPythonLevel($$$$$$$$)
                # then this is where we would need to allocate it
                if ($l->{POINTER_TYPE} eq "ref") {
                        $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
+               } elsif ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::is_scalar($nl->{DATA_TYPE})
+                        and not Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE})) {
+                       $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
                } else {
                        $self->pidl("$var_name = NULL;");
                }