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

Fix memory leaks in slist test #43

Merged
merged 3 commits into from
Apr 13, 2016
Merged

Fix memory leaks in slist test #43

merged 3 commits into from
Apr 13, 2016

Conversation

f2404
Copy link
Contributor

@f2404 f2404 commented Apr 12, 2016

Fixes #40

@srdja As you can see, I had to manually free the memory whenever slist_remove(), slist_remove_first(), slist_remove_last(), slist_remove_at(), slist_replace_at(), or slist_iter_remove() were called.
Do you still think it won't be convenient to free the memory from within the slist code?

Also, there's still memory leak in slist_remove_all() which cannot (UP: can - see below) be resolved from the caller side:

    SList *list;
    slist_1234(&list);
    slist_remove_all(list);

It seems, slist_remove_all_free() should be called instead.

@srdja
Copy link
Owner

srdja commented Apr 13, 2016

You're right. It is tedious to free removed elements by hand. I'm going to open a separate issue #45 to address this.

@srdja srdja merged commit 3bca15d into srdja:master Apr 13, 2016
@f2404 f2404 deleted the slist_test_fix branch April 14, 2016 05:22
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.

Potential memory leaks in slist functions
2 participants