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 double free error #79

Merged
merged 1 commit into from
Dec 8, 2024
Merged

Fix double free error #79

merged 1 commit into from
Dec 8, 2024

Conversation

huaxinliao
Copy link
Collaborator

Removed the free(old) call from the _twin_queue_delete function, consolidating memory deallocation into the _twin_queue_review_order function. This change improves memory management and enhances the maintainability of the code.

The fix was verified using GDB to confirm that old is properly freed during the execution of free(q) in the _twin_queue_review_order function. Additionally, AddressSanitizer was used to confirm the absence of memory leaks and double free issues.

@jserv
Copy link
Contributor

jserv commented Dec 8, 2024

See if walking member should be eliminated or not.

@huaxinliao
Copy link
Collaborator Author

huaxinliao commented Dec 8, 2024

See if walking member should be eliminated or not.

I experimented with the fbdev and SDL backends and confirmed that it can run normally without walking member.

@jserv
Copy link
Contributor

jserv commented Dec 8, 2024

I experimented with the fbdev and SDL backends and confirmed that it can run normally without walking member.

Refine the proposed changes by revisiting the use of walking member.

@jserv jserv changed the title Fix double free error in fbdev backend Fix double free error Dec 8, 2024
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine the git commit messages: Drop the 'fbdev' backend in the subject and mention the observation in 'fbdev' backend in the body instead.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Append Close #75 at the end of git commit messages.

Removed the free(old) call from the _twin_queue_delete function,
consolidating memory deallocation into the _twin_queue_review_order
 function. This change improves memory management and enhances the
maintainability of the code.

The fix was verified on the fbdev backend using GDB to confirm that
 old is properly freed during the execution of free(q) in the
_twin_queue_review_order function. Additionally, on the same
backend, AddressSanitizer was used to confirm the absence of memory
 leaks and double free issues.

Close sysprog21#75
@jserv jserv merged commit af56522 into sysprog21:main Dec 8, 2024
3 checks passed
@jserv
Copy link
Contributor

jserv commented Dec 8, 2024

Thank @huaxinliao for contributing!

@huaxinliao huaxinliao deleted the Double_free branch December 8, 2024 16:16
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.

2 participants