Skip to content

Fix Linux home resource path allocation - #194

Draft
Danmoreng wants to merge 1 commit into
NanoMichael:masterfrom
Danmoreng:codex/fix-linux-home-path-deallocation
Draft

Fix Linux home resource path allocation#194
Danmoreng wants to merge 1 commit into
NanoMichael:masterfrom
Danmoreng:codex/fix-linux-home-path-deallocation

Conversation

@Danmoreng

Copy link
Copy Markdown

Summary

  • build the Linux user resource path directly with std::string
  • remove the temporary asprintf allocation and mismatched delete
  • avoid relying on the GNU-specific asprintf function for this path

Root cause

asprintf allocates with malloc, but queryResourceLocation released the result with delete. AddressSanitizer therefore aborted with an alloc-dealloc-mismatch whenever HOME was set during resource discovery.

Fixes #193.

Validation

  • compiled the changed MicroTeX source as part of a downstream C++20 application
  • downstream unit tests pass
  • downstream ASan/UBSan unit tests pass with halt_on_error=1

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.

Fix malloc/delete mismatch in Linux resource path detection

1 participant