From 994e43e9ebd3922f2c3378edf0e73e912815230a Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@samba.org>
Date: Mon, 14 Jan 2008 18:01:54 +0100
Subject: python: Don't try to free const pointers. (This used to be commit
 b4754f4683e67a940f18a88e45c0878259f45b97)

---
 source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'source4/pidl/lib/Parse/Pidl/Samba4')

diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 84b3405bb9..73442be59d 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -203,7 +203,11 @@ sub PythonStruct($$$$)
 			$self->pidl("if (!strcmp(name, \"$e->{NAME}\")) {");
 			my $varname = "object->$e->{NAME}";
 			$self->indent;
-			if ($e->{ORIGINAL}->{POINTERS} > 0) {
+			my $l = $e->{LEVELS}[0];
+			my $nl = GetNextLevel($e, $l);
+			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 "SCALAR" and $nl->{TYPE} eq "string")) {
 				$self->pidl("talloc_free($varname);");
 			}
 			$self->ConvertObjectFromPython($env, $mem_ctx, $e, "value", $varname, "return -1;");
-- 
cgit