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/8.0/unified/20240613.065534~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea872dc8bfba0017db9f5de766df9b6e95ba4887;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; }