Commit c5351a8d49

Manlio Perillo <manlio.perillo@gmail.com>
2023-01-13 15:20:00
docgen: remove unnecessary and incorrect deallocations
The deallocations of the process arguments are unnecessary, since the memory will be deallocated by arena.deinit(). The deallocations are incorrect, since ArgIterator.next() returns a slice pointing to the iterator's internal buffer, that should be deallocated with args_it.deinit().
1 parent 7cb2f92
Changed files (1)
doc/docgen.zig
@@ -28,13 +28,8 @@ pub fn main() !void {
     if (!args_it.skip()) @panic("expected self arg");
 
     const zig_exe = args_it.next() orelse @panic("expected zig exe arg");
-    defer allocator.free(zig_exe);
-
     const in_file_name = args_it.next() orelse @panic("expected input arg");
-    defer allocator.free(in_file_name);
-
     const out_file_name = args_it.next() orelse @panic("expected output arg");
-    defer allocator.free(out_file_name);
 
     var do_code_tests = true;
     if (args_it.next()) |arg| {