authorgravatar for manlio.perillo@gmail.comManlio Perillo <manlio.perillo@gmail.com> 2023-01-13 15:20:00+01:00
committergravatar for manlio.perillo@gmail.comManlio Perillo <manlio.perillo@gmail.com> 2023-01-13 15:20:00+01:00
logc5351a8d496edd7d76b3fc505f3e078b9e00982e
treed5645ad7972bb117aa6490143da69a7203e85ceb
parent7cb2f9222da38d687e8708dd5d94d3175cc77995

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 files changed, 0 insertions(+), 5 deletions(-)

doc/docgen.zig-5
...@@ -28,13 +28,8 @@ pub fn main() !void {...@@ -28,13 +28,8 @@ pub fn main() !void {
28 if (!args_it.skip()) @panic("expected self arg");28 if (!args_it.skip()) @panic("expected self arg");
2929
30 const zig_exe = args_it.next() orelse @panic("expected zig exe arg");30 const zig_exe = args_it.next() orelse @panic("expected zig exe arg");
31 defer allocator.free(zig_exe);
32
33 const in_file_name = args_it.next() orelse @panic("expected input arg");31 const in_file_name = args_it.next() orelse @panic("expected input arg");
34 defer allocator.free(in_file_name);
35
36 const out_file_name = args_it.next() orelse @panic("expected output arg");32 const out_file_name = args_it.next() orelse @panic("expected output arg");
37 defer allocator.free(out_file_name);
3833
39 var do_code_tests = true;34 var do_code_tests = true;
40 if (args_it.next()) |arg| {35 if (args_it.next()) |arg| {