Skip to content

Does this fix a memory leak?#2

Open
grahame-student wants to merge 5 commits intoPacktPublishing:masterfrom
grahame-student:master
Open

Does this fix a memory leak?#2
grahame-student wants to merge 5 commits intoPacktPublishing:masterfrom
grahame-student:master

Conversation

@grahame-student
Copy link
Copy Markdown

It looks like there could be a memory leak in this example. person_dtor() is not freeing the passed in pointer, therefore when student_dtor() calls the base class' destructor the allocated memory is never released.

If I've missed where there memory is freed I would love to know.

Free the memory the person pointer is pointing at. Otherwise when student_dtor() calls person_dtor() the memory will not be released, resulting in a memory leak
Update ExtremeC_examples_chapter8_3_person.c
Revert "Update ExtremeC_examples_chapter8_3_person.c"
@kamcpp
Copy link
Copy Markdown
Collaborator

kamcpp commented Oct 24, 2021

Hi, sorry for the late reply. I need to look at the example again. Your change seems to be correct and sane but I want to double check.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants