clean up config deinit

This commit is contained in:
Jeffrey C. Ollie 2023-10-14 21:26:06 -05:00
parent 02f224d412
commit b93db148f6
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -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;