diff --git a/Source/ASCGImageBuffer.h b/Source/ASCGImageBuffer.h index 47d4b8d306..88f1fd9c3e 100644 --- a/Source/ASCGImageBuffer.h +++ b/Source/ASCGImageBuffer.h @@ -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; diff --git a/Source/ASCGImageBuffer.m b/Source/ASCGImageBuffer.m index 215dbc696b..8b236f65c6 100644 --- a/Source/ASCGImageBuffer.m +++ b/Source/ASCGImageBuffer.m @@ -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;