From 29862b7547dd2281e495b503e4fba196763955d9 Mon Sep 17 00:00:00 2001 From: hjhun <36876573+hjhun@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:38:58 +0900 Subject: [PATCH] Use Marshal.FreeHGlobal() instead of Libc.Free() (#5636) Signed-off-by: Hwankyu Jhun --- src/Tizen.Content.MimeType/Interop/Interop.Libc.cs | 27 ---------------------- .../Interop/Interop.Libraries.cs | 1 - .../Tizen.Content.MimeType/MimeUtil.cs | 4 ++-- 3 files changed, 2 insertions(+), 30 deletions(-) delete mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Libc.cs diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs deleted file mode 100755 index 825599e..0000000 --- a/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Runtime.InteropServices; - -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); - } -} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs index 365b82e..aa8e295 100755 --- a/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs +++ b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs @@ -20,6 +20,5 @@ internal static partial class Interop { public const string Mime = "libcapi-content-mime-type.so.0"; public const string Glib = "libglib-2.0.so.0"; - public const string Libc = "libc.so.6"; } } diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs index dfce947..02e45a3 100644 --- a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs @@ -86,9 +86,9 @@ namespace Tizen.Content.MimeType foreach (IntPtr extension in extensionList) { coll.Add(Marshal.PtrToStringAnsi(extension)); - Interop.Libc.Free(extension); + Marshal.FreeHGlobal(extension); } - Interop.Libc.Free(extensionArray); + Marshal.FreeHGlobal(extensionArray); return coll; } -- 2.7.4