pluto icon indicating copy to clipboard operation
pluto copied to clipboard

Resource cleanup

Open SamTebbs33 opened this issue 4 years ago • 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.

SamTebbs33 avatar Aug 16 '20 11:08 SamTebbs33

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

b-ncMN avatar Mar 31 '21 15:03 b-ncMN

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.

DrDeano avatar Mar 31 '21 18:03 DrDeano

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.

DrDeano avatar Apr 08 '21 21:04 DrDeano