From: hjhun <36876573+hjhun@users.noreply.github.com> Date: Tue, 17 Oct 2023 04:40:33 +0000 (+0900) Subject: Use Marshal.FreeHGlobal() instead of Libc.Free() (#5628) X-Git-Tag: accepted/tizen/unified/20231205.024657~104 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd4f4e2b20cace812672f0e0f5e842ed2e6ecf78;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git Use Marshal.FreeHGlobal() instead of Libc.Free() (#5628) Signed-off-by: Hwankyu Jhun --- diff --git a/src/Tizen.Applications.Common/Interop/Interop.Libc.cs b/src/Tizen.Applications.Common/Interop/Interop.Libc.cs index 81aacdd..09c256e 100644 --- a/src/Tizen.Applications.Common/Interop/Interop.Libc.cs +++ b/src/Tizen.Applications.Common/Interop/Interop.Libc.cs @@ -23,9 +23,6 @@ internal static partial class Interop { internal static partial class Libc { - [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] - internal static extern int Free(IntPtr ptr); - [DllImport(Libraries.Libc, EntryPoint = "getenv")] internal static extern IntPtr GetEnvironmentVariable(string name); diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs index 3bd02e2..60c213f 100755 --- a/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs @@ -1335,9 +1335,9 @@ namespace Tizen.Applications { IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); stringList.Add(Marshal.PtrToStringAnsi(charArr)); - _ = Interop.Libc.Free(charArr); + Marshal.FreeHGlobal(charArr); } - _ = Interop.Libc.Free(valuePtr); + Marshal.FreeHGlobal(valuePtr); value = stringList; return true; } @@ -1491,9 +1491,9 @@ namespace Tizen.Applications { IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); valueArray.Add(Marshal.PtrToStringAnsi(charArr)); - _ = Interop.Libc.Free(charArr); + Marshal.FreeHGlobal(charArr); } - _ = Interop.Libc.Free(valuePtr); + Marshal.FreeHGlobal(valuePtr); } return valueArray; }