-
Notifications
You must be signed in to change notification settings - Fork 392
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 #8690 - Avoid a double free on Linux for FMU parser #8829
Conversation
…so tweak it to avoid polluting the source... Note: Why does it create ShadingController/binaries/darwin64/ on UBUNTU? darwin64?! (note: CMAKE_CURRENT_BINARY_DIR = build/third_party/FMUParser)
|
||
if(BUILD_TESTING) | ||
# Avoid creating some artifacts (ShadingController/modelDescription.xml and ShadingController/binaries inside "${PROJECT_SOURCE_DIR}/datasets/FMUs/" | ||
configure_file("${PROJECT_SOURCE_DIR}/datasets/FMUs/ShadingController.fmu" "${CMAKE_CURRENT_BINARY_DIR}/ShadingController.fmu" COPYONLY) | ||
add_test(NAME "FMUParser" | ||
COMMAND parser "--printidf" "${CMAKE_CURRENT_BINARY_DIR}/ShadingController.fmu" | ||
) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a ctest to exercise the executable created.
#ifdef _MSC_VER | ||
// https://man7.org/linux/man-pages/man3/basename.3.html | ||
// Both dirname() and basename() return pointers to null-terminated strings. (Do not pass these pointers to free(3).) | ||
free(filNam); | ||
free(ext); | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actual fix.
Tested this on develop and experienced the double free. Tested with this branch and parser successfully creates the tmp.idf file. This is great. And a good test to just exercise parser as a ctest. Thanks @jmarrec ! |
Pull request overview
parser
is broken in 9.5.0 on UbuntuPull Request Author
Add to this list or remove from it as applicable. This is a simple templated set of guidelines.
Reviewer
This will not be exhaustively relevant to every PR.