From f9c6f9f38f7402cf15b55548f79b1d7ad1547e03 Mon Sep 17 00:00:00 2001 From: Bob Farrell Date: Wed, 13 Nov 2024 20:15:24 +0000 Subject: [PATCH] Fix memory leak in auth CLI command --- cli/commands/auth.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/commands/auth.zig b/cli/commands/auth.zig index 0b4432c..a7c301e 100644 --- a/cli/commands/auth.zig +++ b/cli/commands/auth.zig @@ -21,16 +21,16 @@ pub const Options = struct { /// Run the `jetzig database` command. pub fn run( - allocator: std.mem.Allocator, + parent_allocator: std.mem.Allocator, options: Options, writer: anytype, T: type, main_options: T, ) !void { _ = options; - var arena = std.heap.ArenaAllocator.init(allocator); + var arena = std.heap.ArenaAllocator.init(parent_allocator); defer arena.deinit(); - const alloc = arena.allocator(); + const allocator = arena.allocator(); const Action = enum { user_create }; const map = std.StaticStringMap(Action).initComptime(.{ @@ -50,7 +50,7 @@ pub fn run( try args.printHelp(Options, "jetzig database", writer); break :blk {}; } else if (action == null) blk: { - const available_help = try std.mem.join(alloc, "|", map.keys()); + const available_help = try std.mem.join(allocator, "|", map.keys()); std.debug.print("Missing sub-command. Expected: [{s}]\n", .{available_help}); break :blk error.JetzigCommandError; } else if (action) |capture|