Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1fa3ec2

Browse files
committed
1 parent 872fbb8 commit 1fa3ec2

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/runtime/pythonengine.cs

+3-12
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ public static string ProgramName
6969
}
7070
set
7171
{
72-
if (_programName != IntPtr.Zero)
73-
{
74-
Marshal.FreeHGlobal(_programName);
75-
}
72+
Marshal.FreeHGlobal(_programName);
7673
_programName = Runtime.IsPython3
7774
? UcsMarshaler.GetInstance("").MarshalManagedToNative(value)
7875
: Marshal.StringToHGlobalAnsi(value);
@@ -93,10 +90,7 @@ public static string PythonHome
9390
}
9491
set
9592
{
96-
if (_pythonHome != IntPtr.Zero)
97-
{
98-
Marshal.FreeHGlobal(_pythonHome);
99-
}
93+
Marshal.FreeHGlobal(_pythonHome);
10094
_pythonHome = Runtime.IsPython3
10195
? UcsMarshaler.GetInstance("").MarshalManagedToNative(value)
10296
: Marshal.StringToHGlobalAnsi(value);
@@ -117,10 +111,7 @@ public static string PythonPath
117111
}
118112
set
119113
{
120-
if (_pythonPath != IntPtr.Zero)
121-
{
122-
Marshal.FreeHGlobal(_pythonPath);
123-
}
114+
Marshal.FreeHGlobal(_pythonPath);
124115
_pythonPath = Runtime.IsPython3
125116
? UcsMarshaler.GetInstance("").MarshalManagedToNative(value)
126117
: Marshal.StringToHGlobalAnsi(value);

0 commit comments

Comments
 (0)