Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak file.c fopen() #17

Open
JaihsonK opened this issue Feb 11, 2023 · 2 comments
Open

Memory leak file.c fopen() #17

JaihsonK opened this issue Feb 11, 2023 · 2 comments

Comments

@JaihsonK
Copy link

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;

@nibblebits
Copy link
Owner

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

@JaihsonK
Copy link
Author

OK no problem!

Cheers, Jaihson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants