Fix restart parsing of file name (backport of #2792 and #2793)#2815
Merged
andrew-platt merged 2 commits intoOpenFAST:rc-4.0.5from May 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR backports a fix to the parsing of the restart file name in the CPP interface from PR #2792.
- Introduces dynamic allocation for out_file_root using malloc.
- Adds error checking after reading the attribute and ensures proper string termination.
Comments suppressed due to low confidence (1)
glue-codes/openfast-cpp/src/OpenFAST.cpp:106
- Dynamically allocated memory in tmpOutFileRoot is not freed after assignment, which may lead to a memory leak. Consider using a smart pointer or explicitly calling free(tmpOutFileRoot) after the assignment.
turbineData[iTurbLoc].outFileRoot.assign(tmpOutFileRoot);
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR backports fixes for restart file name parsing and a potential memory leak in the C++ interface.
- Replace fixed-size char array with dynamic allocation for retrieving "out_file_root".
- Ensure proper error checking and memory deallocation for dynamically allocated buffer.
Collaborator
Author
deslaughter
approved these changes
May 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ready to merge
Feature or improvement description
PR #2792 fixed a parsing issue with restarts in the cpp interface. That PR will be included in 4.1, but since we are doing a 4.0.5 release, we might as well backport it.
Related issue, if one exists
See #2792 for details.
Also includes #2793 (fix possible memory leak)
Impacted areas of the software
CPP interface restarts only
Test results, if applicable
None.