Skip to content

Commit

Permalink
kc85.zig: proper Args cleanup on success and error
Browse files Browse the repository at this point in the history
  • Loading branch information
floooh committed Jan 14, 2025
1 parent 91acdf1 commit 9ef513c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions emus/kc85/kc85.zig
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ export fn input(ev: ?*const sapp.Event) void {

pub fn main() void {
args = Args.parse(gpa.allocator()) catch {
std.process.exit(10);
return;
};
defer args.deinit();
if (args.help) {
args.deinit();
std.process.exit(0);
return;
}

const display = KC85.displayInfo(null);
Expand Down Expand Up @@ -236,6 +236,7 @@ const Args = struct {
var res = Args{
.allocator = allocator,
};
errdefer res.deinit();
var arg_iter = try std.process.argsWithAllocator(res.allocator);
defer arg_iter.deinit();
_ = arg_iter.skip();
Expand Down

0 comments on commit 9ef513c

Please sign in to comment.