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

added custom malloc implementation #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Igor1101
Copy link

I would like to use your partcl in my embedded projects so I have written malloc for this program in order to remove more dependencies and run it on bare metal. But I found out that your program does not always use free() correctly. Sometimes it does not use correct pointer to allocated memory when uses "subst". Furthermore I could not find where your fault really is. My implementation of free() named "sfree()" prints "free called" when it is really called and prints "FREE ERROR", when it cannot recognize what is the pointer it received. Just type "make|less" to see this. Maybe you can find this mistake?
There is also another problem: partcl does not verify if malloc returns NULL pointer. Maybe it is a good idea to run "exit(1);" from custom malloc/realloc instead of returning NULL.

@whiterocker
Copy link

Hi Igor, at least one memory leak is because at line 331, in tcl_eval( ), the function returns without freeing the variable list. Need to add tcl_list_free(list) before the return.

@skrasser
Copy link
Contributor

@Igor1101, there is a free() on non-heap memory in the tests for subst, so you may have seen that when running make|less. It only impacts the tests. See here: #12.

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.

3 participants