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

Memory leak in RapidExternalEvtGen::decay for Bs mixing #68

Open
lorenzopaolucci opened this issue Nov 28, 2024 · 1 comment
Open

Memory leak in RapidExternalEvtGen::decay for Bs mixing #68

lorenzopaolucci opened this issue Nov 28, 2024 · 1 comment

Comments

@lorenzopaolucci
Copy link

In lines 61-63 in RapidExternalEvtGen.cc

while(theParticle->getNDaug()==1) {
theParticle = theParticle->getDaug(0);
}

the pointer gets overwritten with the final state of the meson, without however making sure the first state is properly deleted, thus creating a memory leak. Suggest to update the while loop to:

while(theParticle->getNDaug()==1) {
EvtParticle* originalState = theParticle;
theParticle = theParticle->getDaug(0);
delete originalState;
}

@lorenzopaolucci
Copy link
Author

lorenzopaolucci commented Nov 29, 2024

Alternatively one could use EvtParticle::deleteTree() to avoid the explicit delete calls in the loops.

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

No branches or pull requests

1 participant