ZystemOS/pluto

Resource cleanup

Opened this issue · 3 comments

Many functions in the kernel allocate resources that are not cleaned up in the case of an error. We should analyse the source and fix where this happens, adding tests as appropriate to make sure this is maintained.

Hi, is this being worked on currently ? If yes then I would like to participate, if not then I will try

Sure, you have ago. So yeh, anything that allocates memory will need leak checking for all error cases. There are examples, e.g. in the initrd.zig tests, that checks for memory leaks for each error condition. So we would like to ensure this testing is consistent through the code base.

Might also be interesting to add a function that can do this kinds of testing where it will automatically test each failed allocation. Basically how the Zig fmt testing works when testing its parsing and rendering.