Skip to content

Commit

Permalink
[NoCopyRendering] In non-VM case, use calloc to get a zerod buffer. (T…
Browse files Browse the repository at this point in the history
  • Loading branch information
Adlai-Holler authored Apr 4, 2018
1 parent e748d05 commit e90ba47
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/ASCGImageBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Source/ASCGImageBuffer.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ - (instancetype)initWithLength:(NSUInteger)length

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

0 comments on commit e90ba47

Please sign in to comment.