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

[BUG] DeviceControllerFactory::InitSystemState initializes FabricTable, but DeviceControllerSystemState::Shutdown() does not shut it down #22901

Closed
msandstedt opened this issue Sep 27, 2022 · 1 comment · Fixed by #22932
Assignees
Labels
leak Memory leak bug

Comments

@msandstedt
Copy link
Contributor

msandstedt commented Sep 27, 2022

Reproduction steps

Can be discovered by inspection.

FabricTable::Init is called here:

ReturnErrorOnFailure(newFabricTable->Init(fabricTableInitParams));

FabricTable::Shutdown is not called here:

if (mTempFabricTable != nullptr)

This can likely lead to leaks if FabricTable isn't freeing its dynamically allocated memory with Shutdown, e.g. these allocations:

mOperationalKey = chip::Platform::New<P256Keypair>();

It was also discovered on adding the missing shutdown that the Python controller frees the storage delegate injected into the Fabric Table before the Fabric Table is freed, leading to use-after-free. That is addressed here:

#22963

Bug prevalence

Always occurs if DeviceControllerFactory allocates the FabricTable

GitHub hash of the SDK that was being used

33b4fab

Platform

other (controllers)

Platform Version(s)

No response

Anything else?

No response

@msandstedt
Copy link
Contributor Author

CC @gharveymn

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

Successfully merging a pull request may close this issue.

1 participant