fix segfault

This commit is contained in:
Emil Lerch 2026-03-06 15:13:33 -08:00
parent 71a5c548d5
commit 14df3b1050
Signed by: lobo
GPG key ID: A7B62D657EF764F8

8
src/cache/store.zig vendored
View file

@ -274,11 +274,15 @@ pub const Store = struct {
}
var reader = std.Io.Reader.fixed(data);
const parsed = srf.parse(&reader, allocator, .{ .alloc_strings = true }) catch return error.InvalidData;
const parsed = srf.parse(&reader, allocator, .{ .alloc_strings = false }) catch return error.InvalidData;
defer parsed.deinit();
for (parsed.records.items) |record| {
const div = record.to(Dividend) catch continue;
var div = record.to(Dividend) catch continue;
// Dupe owned strings before parsed.deinit() frees the backing buffer
if (div.currency) |c| {
div.currency = allocator.dupe(u8, c) catch null;
}
try dividends.append(allocator, div);
}