diff options
| author | 2024-12-13 20:10:48 +0000 | |
|---|---|---|
| committer | 2024-12-13 20:10:48 +0000 | |
| commit | db54c499bf84248da493d8baab27bf66b52c9ebb (patch) | |
| tree | a2e1f3de85e6a1d8a8f352043f0371859832b92b | |
| parent | Update URL in README (diff) | |
| parent | Fix leak of cwcf_exceptions in FoldData (diff) | |
| download | zg-db54c499bf84248da493d8baab27bf66b52c9ebb.tar.gz zg-db54c499bf84248da493d8baab27bf66b52c9ebb.tar.xz zg-db54c499bf84248da493d8baab27bf66b52c9ebb.zip | |
Merge pull request 'Fix leak of cwcf_exceptions in FoldData' (#21) from squeek502/zg:folddata-leak into master
Reviewed-on: https://codeberg.org/atman/zg/pulls/21
| -rw-r--r-- | src/FoldData.zig | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/FoldData.zig b/src/FoldData.zig index d425178..a3d47af 100644 --- a/src/FoldData.zig +++ b/src/FoldData.zig | |||
| @@ -47,6 +47,7 @@ pub fn init(allocator: mem.Allocator) !Self { | |||
| 47 | self.cwcf_exceptions_max = @intCast(try reader.readInt(u24, endian)); | 47 | self.cwcf_exceptions_max = @intCast(try reader.readInt(u24, endian)); |
| 48 | len = try reader.readInt(u16, endian); | 48 | len = try reader.readInt(u16, endian); |
| 49 | self.cwcf_exceptions = try allocator.alloc(u21, len); | 49 | self.cwcf_exceptions = try allocator.alloc(u21, len); |
| 50 | errdefer allocator.free(self.cwcf_exceptions); | ||
| 50 | for (0..len) |i| self.cwcf_exceptions[i] = @intCast(try reader.readInt(u24, endian)); | 51 | for (0..len) |i| self.cwcf_exceptions[i] = @intCast(try reader.readInt(u24, endian)); |
| 51 | 52 | ||
| 52 | return self; | 53 | return self; |
| @@ -56,6 +57,7 @@ pub fn deinit(self: *const Self) void { | |||
| 56 | self.allocator.free(self.stage1); | 57 | self.allocator.free(self.stage1); |
| 57 | self.allocator.free(self.stage2); | 58 | self.allocator.free(self.stage2); |
| 58 | self.allocator.free(self.stage3); | 59 | self.allocator.free(self.stage3); |
| 60 | self.allocator.free(self.cwcf_exceptions); | ||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | /// Returns the case fold for `cp`. | 63 | /// Returns the case fold for `cp`. |