PeachOS icon indicating copy to clipboard operation
PeachOS copied to clipboard

Memory leak file.c fopen()

Open JaihsonK opened this issue 2 years ago • 2 comments

Hey Dan!

I found a memory leak in the fopen() function. In case of an error, we do not free root_path or descriptor_private_data. this would create a memory leak, especially if the error occurs on line 175 (PeachOS-master). My proposed solution is as follows:

out: // fopen shouldnt return negative values if (res < 0) { if(root_path) pathparser_free(root_path); if(descriptor_private_data) kfree(descriptor_private_data); res = 0; } return res;

JaihsonK avatar Feb 11 '23 22:02 JaihsonK

Thanks for that much appreciated, I know youve made a couple issue reports don't worry I am not ignoring you, I am waiting because I plan to make a part 2 to the course, so just before I start I plan to make one big lecture fixing all of the problems

nibblebits avatar Feb 12 '23 00:02 nibblebits

OK no problem!

Cheers, Jaihson

JaihsonK avatar Feb 13 '23 15:02 JaihsonK