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

Update config parsing methods to ensure that any built-in functions that allocate memory for linked list data structures don't leak/orphan memory with subsequent calls #47

Open
morgant opened this issue Aug 24, 2024 · 0 comments
Assignees
Milestone

Comments

@morgant
Copy link
Owner

morgant commented Aug 24, 2024

As discovered in Issue #45, SetStartFunction() in mlvwm/config.c contains a bug which can orphan linked list objects, leaking memory, with subsequent parsing of InitFunction/RestartFunction built-in function blocks in config files. This is because it references a pointer stored in the Scr variable's data structure, then allocates memory for a new object into that referenced variable in the first iteration of the parsing loop, effectively starting a new linked list instead of appending to the existing one, if one exists. Unfortunately, while it intentionally replaces the old linked list of parsed configuration data/settings upon subsequent executions, it doesn't actually free any prior linked list objects if they already exist.

Since this parsing into linked lists of data/settings is a common pattern in the mlvwm implementation, I suspect this bug occurs in a number of the other configuration parsing methods in mlvwm/config.c. Upon completing issue #45, let's look for and fix any similar memory leak bugs en masse.

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

No branches or pull requests

1 participant