From: Matt Corallo Date: Wed, 24 Jan 2024 03:17:10 +0000 (+0000) Subject: [C#] Free array buffers passed to C# after we've decoded them X-Git-Tag: v0.0.121.0~13 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=644b85102d5bfffbfc409cdb871b8d0582240051;p=ldk-java [C#] Free array buffers passed to C# after we've decoded them --- diff --git a/c_sharp/src/org/ldk/util/InternalUtils.cs b/c_sharp/src/org/ldk/util/InternalUtils.cs index 927409e2..9296adf0 100644 --- a/c_sharp/src/org/ldk/util/InternalUtils.cs +++ b/c_sharp/src/org/ldk/util/InternalUtils.cs @@ -124,6 +124,7 @@ internal class InternalUtils { byte[] res = new byte[len]; for (int i = 0; i < len; i++) res[i] = getU8ArrayElem(arrptr, i); + bindings.free_buffer(arrptr); return res; } public static short[] decodeUint16Array(long arrptr) { @@ -131,6 +132,7 @@ internal class InternalUtils { short[] res = new short[len]; for (int i = 0; i < len; i++) res[i] = getU16ArrayElem(arrptr, i); + bindings.free_buffer(arrptr); return res; } public static long[] decodeUint64Array(long arrptr) { @@ -138,6 +140,7 @@ internal class InternalUtils { long[] res = new long[len]; for (int i = 0; i < len; i++) res[i] = getU64ArrayElem(arrptr, i); + bindings.free_buffer(arrptr); return res; } }