summaryrefslogtreecommitdiff
path: root/src/FoldData.zig
diff options
context:
space:
mode:
authorGravatar atman2024-12-13 20:10:48 +0000
committerGravatar atman2024-12-13 20:10:48 +0000
commitdb54c499bf84248da493d8baab27bf66b52c9ebb (patch)
treea2e1f3de85e6a1d8a8f352043f0371859832b92b /src/FoldData.zig
parentUpdate URL in README (diff)
parentFix leak of cwcf_exceptions in FoldData (diff)
downloadzg-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
Diffstat (limited to 'src/FoldData.zig')
-rw-r--r--src/FoldData.zig2
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`.