Skip to content

Commit fc0c0de

Browse files
committed
Fix memory corruption with NSMutableData(length:)
1 parent 182d5c9 commit fc0c0de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/NSData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ extension NSMutableData {
907907

908908
public convenience init?(length: Int) {
909909
let memory = malloc(length)
910-
self.init(bytes: memory, length: length, copy: false) { buffer, amount in
910+
self.init(bytes: memory, length: length, copy: true) { buffer, amount in
911911
free(buffer)
912912
}
913913
}

0 commit comments

Comments
 (0)