diff --git a/SharpPcap/LibPcap/LibPcapSafeNativeMethods.Encoding.cs b/SharpPcap/LibPcap/LibPcapSafeNativeMethods.Encoding.cs index 18fa7805..b1a41ee9 100644 --- a/SharpPcap/LibPcap/LibPcapSafeNativeMethods.Encoding.cs +++ b/SharpPcap/LibPcap/LibPcapSafeNativeMethods.Encoding.cs @@ -91,8 +91,6 @@ public IntPtr MarshalManagedToNative(object managedObj) } var str = (string)managedObj; var bytes = StringEncoding.GetBytes(str); - // The problem is that we need a reference to the StringBuilder in MarshalNativeToManaged - // So we get a pointer to it with GCHandle, and put it as prefix of the pointer we return var ptr = Marshal.AllocHGlobal(bytes.Length + 1); Marshal.Copy(bytes, 0, ptr, bytes.Length); // Put zero string termination