diff --git a/DXFeedFramework/Native/Events/Markets/TradeETHMapper.swift b/DXFeedFramework/Native/Events/Markets/TradeETHMapper.swift index 28a253912..00f8f6c73 100644 --- a/DXFeedFramework/Native/Events/Markets/TradeETHMapper.swift +++ b/DXFeedFramework/Native/Events/Markets/TradeETHMapper.swift @@ -42,4 +42,3 @@ class TradeETHMapper: Mapper { return eventType } } - diff --git a/DXFeedFramework/Native/Ipf/NativeInstrumentProfileReader.swift b/DXFeedFramework/Native/Ipf/NativeInstrumentProfileReader.swift index 477ebe56c..41abf18d5 100644 --- a/DXFeedFramework/Native/Ipf/NativeInstrumentProfileReader.swift +++ b/DXFeedFramework/Native/Ipf/NativeInstrumentProfileReader.swift @@ -85,6 +85,9 @@ class NativeInstrumentProfileReader { address.toCStringRef())) else { return address } + defer { + _ = try? ErrorCheck.nativeCall(thread, dxfg_String_release(thread, result)) + } return String(pointee: result) } diff --git a/DXFeedFramework/Native/Property/NativeProperty.swift b/DXFeedFramework/Native/Property/NativeProperty.swift index a2672391a..066f453ea 100644 --- a/DXFeedFramework/Native/Property/NativeProperty.swift +++ b/DXFeedFramework/Native/Property/NativeProperty.swift @@ -24,14 +24,15 @@ class NativeProperty { static func getProperty(_ key: String) -> String? { let thread = currentThread() - let property = dxfg_system_get_property(thread, - key.cString(using: .utf8)) - if let property = property { - let result = String(utf8String: property) - dxfg_system_release_property(thread, property) - return result - } else { - return nil + if let property = try? ErrorCheck.nativeCall(thread, + dxfg_system_get_property( + thread, + key.cString(using: .utf8))) { + defer { + _ = try? ErrorCheck.nativeCall(thread, dxfg_system_release_property(thread, property)) + } + return String(pointee: property) } + return nil } } diff --git a/DXFeedFrameworkTests/IPFTests.swift b/DXFeedFrameworkTests/IPFTests.swift index 4138b2fdd..c3a7e32ea 100644 --- a/DXFeedFrameworkTests/IPFTests.swift +++ b/DXFeedFrameworkTests/IPFTests.swift @@ -265,4 +265,10 @@ STOCK,EREGL:TR,EREĞLİ DEMİR VE ÇELİK FABRİKALARI1 T.A.Ş.,TR,XIST,XIST,TRY let result = try collector.createOnFixedThreadPool(numberOfThreads: 15, nameOfthread: "test_ios_thread") XCTAssert(result, "createOnFixedThreadPool failed") } + + func testResolveSourceURL() throws { + let inputStr = "abcde" + let resultstr = DXInstrumentProfileReader.resolveSourceURL(address: inputStr) + XCTAssert(inputStr == resultstr) + } }