[NoCopyRendering] In non-VM case, use calloc to get a zerod buffer. (#869)

This commit is contained in:
Adlai Holler 2018-04-04 13:32:23 -07:00 committed by GitHub
parent e748d053d1
commit e90ba47a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
AS_SUBCLASSING_RESTRICTED
@interface ASCGImageBuffer : NSObject
/// Init a zero-filled buffer with the given length.
- (instancetype)initWithLength:(NSUInteger)length;
@property (readonly) void *mutableBytes NS_RETURNS_INNER_POINTER;

View File

@ -47,7 +47,7 @@
// Check the VM flag again because we may have failed above.
if (!_isVM) {
_mutableBytes = malloc(length);
_mutableBytes = calloc(1, length);
}
}
return self;