Skip to content

[RF] Fix memory leak of ConcatFileName return value in RooWorkspace #18730

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guitargeek
Copy link
Contributor

Fix a memory leak of the TSystem::ConcatFileName() return value in RooWorkspace, and also refactor the code to avoid repetition.

Thanks a lot to @ferdymercury for noticing this!
#18726 (comment)

Fix a memory leak of the `TSystem::ConcatFileName()` return value in
RooWorkspace, and also refactor the code to avoid repetition.

Thanks a lot to @ferdymercury for noticing this!
@guitargeek guitargeek force-pushed the workspace_memleak branch from bc4454c to b4b9226 Compare May 15, 2025 07:00
Copy link
Collaborator

@ferdymercury ferdymercury left a comment

Choose a reason for hiding this comment

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

Thanks for the swift fix!

Copy link

github-actions bot commented May 15, 2025

Test Results

    19 files      19 suites   3d 10h 49m 20s ⏱️
 2 745 tests  2 745 ✅ 0 💤 0 ❌
50 715 runs  50 715 ✅ 0 💤 0 ❌

Results for commit b4b9226.

♻️ This comment has been updated with latest results.

@guitargeek guitargeek closed this May 15, 2025
@guitargeek guitargeek reopened this May 15, 2025
// Check list of additional paths
for (std::string const &diter : dirList) {

char *cpath = gSystem->ConcatFileName(diter.c_str(), file.c_str());
Copy link
Contributor

@silverweed silverweed May 16, 2025

Choose a reason for hiding this comment

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

This ConcatFileName function is horrible! Any chance we could deprecate it and provide a new one that returns a std::string? (Looking at its implementation it doesn't even make sense that it returns a char * rather than a TString...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course it is horrible, haha! But can you maybe still approve the fix I have now, so I can merge and backport it? For the future, I agree we should absolutely get rid of this function.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sorry, I wasn't implying that it should be done in this PR, just something to think of for the future :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants