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

Skip to content

Commit 84209c6

Browse files
committed
Re-raise exception after freeing memory
1 parent f01e853 commit 84209c6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/runtime/CustomMarshaler.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public override IntPtr MarshalManagedToNative(object managedObj)
6262
catch (Exception)
6363
{
6464
Marshal.FreeHGlobal(mem);
65+
throw;
6566
}
6667

6768
return mem;
@@ -111,6 +112,7 @@ public override IntPtr MarshalManagedToNative(object managedObj)
111112
catch (Exception)
112113
{
113114
Marshal.FreeHGlobal(mem);
115+
throw;
114116
}
115117

116118
return mem;
@@ -155,6 +157,7 @@ public override IntPtr MarshalManagedToNative(object managedObj)
155157
catch (Exception)
156158
{
157159
Marshal.FreeHGlobal(mem);
160+
throw;
158161
}
159162

160163
return mem;

0 commit comments

Comments
 (0)