Skip to content

Commit

Permalink
fix pointer nil
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Sep 11, 2016
1 parent e79e5c0 commit 49dc1ca
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Sources/MySQL/Bind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,15 @@ public final class Bind {
C binding.
*/
deinit {
let bufferLength = Int(cBind.buffer_length)
cBind.buffer.deallocate(bytes: bufferLength, alignedTo: MemoryLayout<Void>.alignment)

cBind.length.deinitialize()
cBind.length.deallocate(capacity: 1)
if let pointer = cBind.buffer {
let bufferLength = Int(cBind.buffer_length)
pointer.deallocate(bytes: bufferLength, alignedTo: MemoryLayout<Void>.alignment)
}

if let pointer = cBind.length {
pointer.deinitialize()
pointer.deallocate(capacity: 1)
}

if let pointer = cBind.is_null {
pointer.deinitialize()
Expand Down

0 comments on commit 49dc1ca

Please sign in to comment.