Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak from address pointer allocation #55

Merged
merged 1 commit into from Mar 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/Socket.swift
Expand Up @@ -1157,7 +1157,7 @@ public class Socket: SocketReader, SocketWriter {
///
public class func createAddress(for host: String, on port: Int32) -> Address? {

var info: UnsafeMutablePointer<addrinfo>? = UnsafeMutablePointer<addrinfo>.allocate(capacity: 1)
var info: UnsafeMutablePointer<addrinfo>?

// Retrieve the info on our target...
var status: Int32 = getaddrinfo(host, String(port), nil, &info)
Expand Down Expand Up @@ -1700,7 +1700,7 @@ public class Socket: SocketReader, SocketWriter {
ai_next: nil)
#endif

var targetInfo: UnsafeMutablePointer<addrinfo>? = UnsafeMutablePointer<addrinfo>.allocate(capacity: 1)
var targetInfo: UnsafeMutablePointer<addrinfo>?

// Retrieve the info on our target...
var status: Int32 = getaddrinfo(host, String(port), &hints, &targetInfo)
Expand Down Expand Up @@ -2056,7 +2056,7 @@ public class Socket: SocketReader, SocketWriter {
ai_next: nil)
#endif

var targetInfo: UnsafeMutablePointer<addrinfo>? = UnsafeMutablePointer<addrinfo>.allocate(capacity: 1)
var targetInfo: UnsafeMutablePointer<addrinfo>?

// Retrieve the info on our target...
let status: Int32 = getaddrinfo(nil, String(port), &hints, &targetInfo)
Expand Down