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

Pass pkg_editor tests with address sanitizer #190

Merged
merged 4 commits into from
Nov 2, 2022

Conversation

pcolberg
Copy link
Contributor

@pcolberg pcolberg commented Oct 28, 2022

This resolves various memory leaks in the pkg_editor library. The ELF library requires the user to ensure that a buffer assigned to d_buf in the Elf_Data struct is alive at the time elf_update() is called. This was previously achieved by allocating buffers and not freeing them at all, which leaks the allocated memory. To resolve the memory leaks, these commits either introduce statically allocated buffers, or track the dynamically allocated buffers and free them when closing the ELF file.

(Since I could not find detailed man pages for elfutils, I linked to the OpenBSD man pages above which are strictly for the OpenBSD implementation of libelf.)

This is a prerequisite of #118

@pcolberg pcolberg added the bug Something isn't working label Oct 28, 2022
@pcolberg pcolberg added this to the 2023.1 milestone Oct 28, 2022
@pcolberg pcolberg self-assigned this Oct 28, 2022
@pcolberg pcolberg linked an issue Oct 28, 2022 that may be closed by this pull request
@pcolberg pcolberg force-pushed the pkg_editor branch 3 times, most recently from d7a23a4 to 80ef266 Compare November 1, 2022 22:30
@pcolberg pcolberg marked this pull request as ready for review November 2, 2022 00:56
@pcolberg pcolberg requested review from sophimao and zibaiwan November 2, 2022 00:56
@pcolberg pcolberg force-pushed the pkg_editor branch 2 times, most recently from 08045a9 to 7409360 Compare November 2, 2022 01:28
Copy link
Contributor

@zibaiwan zibaiwan left a comment

Choose a reason for hiding this comment

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

Looks good to me! Thanks @pcolberg !

Copy link
Contributor

@sophimao sophimao left a comment

Choose a reason for hiding this comment

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

Thanks Peter!

@pcolberg pcolberg merged commit 476fd47 into intel:main Nov 2, 2022
@pcolberg pcolberg deleted the pkg_editor branch November 2, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass pkg_editor tests with address sanitizer
3 participants