diff --git a/src/location/Ip2location.zig b/src/location/Ip2location.zig index 05fe038..541959c 100644 --- a/src/location/Ip2location.zig +++ b/src/location/Ip2location.zig @@ -253,7 +253,12 @@ pub const Cache = struct { } 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 {