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

Particle manager leaks physics force data memory #3213

Open
SamVanheer opened this issue Dec 24, 2021 · 0 comments
Open

Particle manager leaks physics force data memory #3213

SamVanheer opened this issue Dec 24, 2021 · 0 comments

Comments

@SamVanheer
Copy link

The particle manager maintains a list of active physics forces added using this method:

virtual void ApplyForce ( Vector vOrigin, Vector vDirection, float flRadius, float flStrength, float flDuration ) = 0;

In IParticleMan_Active::Update forces that have timed out are supposed to be removed, but due to faulty logic the memory for these objects isn't actually freed.

Apparently when this code calls delete on the object, it first changes the pointer to the object to null, like this:

ForceMember* object = ...; //Physics force object, obtained earlier on

if (object has timed out)
{
    object = nullptr;
    delete object;
}

This causes a memory leak that will eventually crash the program.

There does not appear to be any code in official games using this particular method, but any mods that use it will be affected by the leak.

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