commit c021a445672fde506dbbcc331ca3b846f9b6e2a1 (tree)
parent 8be6c98ca63dac5cf5e769171bb72cd888efbbf4
Author: Bas van den Berg <mailbasvandenberg@gmail.com>
Date: Sat, 14 Jul 2018 18:05:05 +0200
Fix aligned reallocation from zero size.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/std/mem.zig b/std/mem.zig
@@ -74,7 +74,7 @@ pub const Allocator = struct {
pub fn alignedRealloc(self: *Allocator, comptime T: type, comptime alignment: u29, old_mem: []align(alignment) T, n: usize) ![]align(alignment) T {
if (old_mem.len == 0) {
- return self.alloc(T, n);
+ return self.alignedAlloc(T, alignment, n);
}
if (n == 0) {
self.free(old_mem);