Skip to content

Commit

Permalink
Fix for conflicting memory access to delegate in ClientRequest (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
nethraravindran authored and djones6 committed Nov 30, 2018
1 parent bcbd4b5 commit 70bbbbb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/KituraNet/ClientRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -659,11 +659,11 @@ private class CurlInvoker {
fileprivate func invoke() -> CURLcode {

var rc: CURLcode = CURLE_FAILED_INIT
if delegate == nil {
guard let delegate = self.delegate else {
return rc
}

withUnsafeMutablePointer(to: &delegate) {ptr in
withUnsafeMutablePointer(to: &self.delegate) {ptr in
self.prepareHandle(ptr)

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

0 comments on commit 70bbbbb

Please sign in to comment.