pidl:Python: use discard_const() to pass a possible const pointer to talloc_unlink()
authorStefan Metzmacher <metze@samba.org>
Thu, 11 Jun 2015 07:58:13 +0000 (09:58 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 12 Jun 2015 15:08:19 +0000 (17:08 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
pidl/lib/Parse/Pidl/Samba4/Python.pm

index b634137cd5db668dab3c3900b2a9761b411c8744..1d271bfa5253dd83772863bf405d5f3fea8d8971 100644 (file)
@@ -224,7 +224,7 @@ sub PythonStruct($$$$$$)
                        if ($l->{TYPE} eq "POINTER" and 
                                not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and
                                not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) {
-                               $self->pidl("talloc_unlink(pytalloc_get_mem_ctx(py_obj), $varname);");
+                               $self->pidl("talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const($varname));");
                        }
                        $self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;");
                        $self->pidl("return 0;");