fix double free
All checks were successful
Generic zig build / build (push) Successful in 1m16s
Generic zig build / deploy (push) Successful in 14s

This commit is contained in:
Emil Lerch 2026-03-05 14:48:19 -08:00
parent 72b3c624d1
commit c9f3681460
Signed by: lobo
GPG key ID: A7B62D657EF764F8

View file

@ -253,7 +253,12 @@ pub const Cache = struct {
} }
pub fn get(self: *Cache, ip: u128) ?Location { pub fn get(self: *Cache, ip: u128) ?Location {
return self.entries.get(ip); const entry = self.entries.get(ip) orelse return null;
return .{
.allocator = self.allocator,
.name = self.allocator.dupe(u8, entry.name) catch return null,
.coords = entry.coords,
};
} }
pub fn put(self: *Cache, ip: u128, family: u8, loc: Location) !void { pub fn put(self: *Cache, ip: u128, family: u8, loc: Location) !void {