diff --git a/src/main.zig b/src/main.zig index 08061f8..71e31b2 100644 --- a/src/main.zig +++ b/src/main.zig @@ -47,14 +47,6 @@ const Config = struct { path: ?[]const u8 = null, port: ?u16 = null, }, - - pub fn deinit(self: @This(), allocator: std.mem.Allocator) void { - allocator.free(self.loki.url); - allocator.free(self.loki.username); - if (self.loki.password) |password| allocator.free(password); - if (self.loki.password_file) |password_file| allocator.free(password_file); - if (self.iperf3.path) |path| allocator.free(path); - } }; pub fn ConfigWrapper(comptime T: type) type { @@ -94,6 +86,7 @@ pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); const config = try readConfig(allocator, "config.json"); + defer config.deinit(); const b64 = std.base64.standard.Encoder;