From 644b85102d5bfffbfc409cdb871b8d0582240051 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 24 Jan 2024 03:17:10 +0000 Subject: [PATCH] [C#] Free array buffers passed to C# after we've decoded them --- c_sharp/src/org/ldk/util/InternalUtils.cs | 3 +++ 1 file changed, 3 insertions(+) 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; } } -- 2.30.2