clean up config deinit
This commit is contained in:
parent
02f224d412
commit
b93db148f6
1 changed files with 1 additions and 8 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue