Use Marshal.FreeHGlobal() instead of Libc.Free() (#5636)
authorhjhun <36876573+hjhun@users.noreply.github.com>
Wed, 18 Oct 2023 05:38:58 +0000 (14:38 +0900)
committerGitHub <noreply@github.com>
Wed, 18 Oct 2023 05:38:58 +0000 (14:38 +0900)
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/Tizen.Content.MimeType/Interop/Interop.Libc.cs [deleted file]
src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs
src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.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 (executable)
index 825599e..0000000
+++ /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);
-    }
-}
index 365b82e..aa8e295 100755 (executable)
@@ -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";
     }
 }
index dfce947..02e45a3 100644 (file)
@@ -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;
         }