pidl-python: ensure we allocate ref ptrs before use
authorAndrew Tridgell <tridge@samba.org>
Thu, 26 Aug 2010 07:50:13 +0000 (17:50 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 26 Aug 2010 12:50:20 +0000 (22:50 +1000)
this fixes a crash on samba4.samr.python in the build farm

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

index eb39718bb5c17b6e2bc0e7bf804fbdac1a73c11a..05c11be07f47fc004b31c6de0ce9f58b96fa71c4 100644 (file)
@@ -947,7 +947,11 @@ sub ConvertObjectFromPythonLevel($$$$$$$$$)
                }
                # if we want to handle more than one level of pointer in python interfaces
                # then this is where we would need to allocate it
-               $self->pidl("$var_name = NULL;");
+               if ($l->{POINTER_TYPE} eq "ref") {
+                       $self->pidl("$var_name = talloc_ptrtype($mem_ctx, $var_name);");
+               } else {
+                       $self->pidl("$var_name = NULL;");
+               }
                $self->ConvertObjectFromPythonLevel($env, $mem_ctx, $mem_ref, $py_var, $e, $nl, get_value_of($var_name), $fail);
                if ($l->{POINTER_TYPE} ne "ref") {
                        $self->deindent;