| ... | @@ -86,12 +86,10 @@ const ObjectArray = struct { | ... | @@ -86,12 +86,10 @@ const ObjectArray = struct { |
| 86 | /// create a new ObjectArray with n slots. must call deinit() to deallocate. | 86 | /// create a new ObjectArray with n slots. must call deinit() to deallocate. |
| 87 | pub fn init(n: usize) *ObjectArray { | 87 | pub fn init(n: usize) *ObjectArray { |
| 88 | var array = simple_allocator.alloc(ObjectArray); | 88 | var array = simple_allocator.alloc(ObjectArray); |
| 89 | errdefer simple_allocator.free(array); | | |
| 90 | | 89 | |
| 91 | array.* = ObjectArray{ | 90 | array.* = ObjectArray{ |
| 92 | .slots = simple_allocator.allocSlice(?ObjectPointer, n), | 91 | .slots = simple_allocator.allocSlice(?ObjectPointer, n), |
| 93 | }; | 92 | }; |
| 94 | errdefer simple_allocator.free(array.slots); | | |
| 95 | | 93 | |
| 96 | for (array.slots) |*object| { | 94 | for (array.slots) |*object| { |
| 97 | object.* = null; | 95 | object.* = null; |