Skip to content

Commit

Permalink
Fix for conflicting memory access to delegate in ClientRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
nethraravindran committed Oct 18, 2018
1 parent f791c0a commit 42c6dd3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/KituraNet/ClientRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ private class CurlInvoker {
return rc
}

guard let copyOfDelegate = delegate else { fatalError("Delegate is nil") }
withUnsafeMutablePointer(to: &delegate) {ptr in
self.prepareHandle(ptr)

Expand All @@ -689,7 +690,7 @@ private class CurlInvoker {
_ = curlHelperSetOptInt(handle, CURLOPT_HTTPGET, 1)
}
redirected = true
delegate?.prepareForRedirect()
copyOfDelegate.prepareForRedirect()
}
else {
redirected = false
Expand Down

0 comments on commit 42c6dd3

Please sign in to comment.