diff --git a/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs b/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs index 576a6e287cf..ee7a1e1cd98 100644 --- a/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs +++ b/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs @@ -26,5 +26,8 @@ internal static partial class Glib [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + + [DllImport(Libraries.Glib, EntryPoint = "g_free", CallingConvention = CallingConvention.Cdecl)] + internal static extern void Gfree(IntPtr ptr); } } diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs index 99a856d1f5f..d74b045fa0f 100644 --- a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs @@ -534,14 +534,14 @@ internal BluetoothOobData GetLocalOobData() byte[] hashArr = new byte[hashLength]; Marshal.Copy(hash, hashArr, 0, hashLength); oobData.HashValue = hashArr; - Interop.Libc.Free(hash); + Interop.Glib.Gfree(hash); } if (randomizerLength > 0) { byte[] randomizerArr = new byte[randomizerLength]; Marshal.Copy(randomizer, randomizerArr, 0, randomizerLength); oobData.RandomizerValue = randomizerArr; - Interop.Libc.Free(randomizer); + Interop.Glib.Gfree(randomizer); } return oobData; diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs index 890c80e3e4a..4cd0a805106 100644 --- a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs @@ -187,10 +187,10 @@ internal IList GetLeScanResultServiceUuids(BluetoothLeScanData scanData, foreach (IntPtr uuids in uuidList) { list.Add(Marshal.PtrToStringAnsi(uuids)); - Interop.Libc.Free(uuids); + Interop.Glib.Gfree(uuids); } - Interop.Libc.Free(uuidListArray); + Interop.Glib.Gfree(uuidListArray); Marshal.FreeHGlobal(scanDataStruct.AdvData); Marshal.FreeHGlobal(scanDataStruct.ScanData); return list; @@ -295,10 +295,10 @@ internal IList GetScanResultSvcSolicitationUuids(BluetoothLeScanData sca foreach (IntPtr uuids in uuidList) { list.Add(Marshal.PtrToStringAnsi(uuids)); - Interop.Libc.Free(uuids); + Interop.Glib.Gfree(uuids); } - Interop.Libc.Free(uuidListArray); + Interop.Glib.Gfree(uuidListArray); Marshal.FreeHGlobal(scanDataStruct.AdvData); Marshal.FreeHGlobal(scanDataStruct.ScanData); return list; @@ -417,7 +417,7 @@ internal ManufacturerData GetScanResultManufacturerData(BluetoothLeScanData scan Marshal.Copy(manufData, data.Data, 0, data.DataLength); } - Interop.Libc.Free(manufData); + Interop.Glib.Gfree(manufData); Marshal.FreeHGlobal(scanDataStruct.AdvData); Marshal.FreeHGlobal(scanDataStruct.ScanData); return data;