Skip to content

Fix memory leak from include macro in KeyValues::LoadFromBuffer() #1278

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DreamyCecil
Copy link

Description

When looking through the code of KeyValues class to understand its format and statements, I noticed a potential memory leak when using the #include macro.

From the looks of things, every time an #include macro or a #base macro is used, it adds all keys from each included file to the current list and deletes the original lists. With #base macro, it seems to delete all included lists. However, with #include macro, it always forgets to delete the only/first/last included list, resulting in a small memory leak.

I'm new to the Source engine and was not able to debug this issue properly, so I apologize if this isn't a bug.
I was able to catch instances of the #base macro being used with a breakpoint upon starting the game but never any #include macros, even with the implemented fix.

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

Successfully merging this pull request may close these issues.

1 participant