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

Fix crash caused by uninitialized variable #7230

Merged
merged 3 commits into from
Jun 2, 2021

Conversation

bluebin14
Copy link
Contributor

Problem

What is being fixed?

Change overview

This PR fixes crash caused by uninitialized member variable. The crash happened in DeviceController::Shutdown().

Testing

How was this tested? (at least one bullet point required)

  • launch chip-device-ctrl
  • commission accessory e.g. connect -ble 3840 12345678 12344321
  • optionally enter any other commands
  • issue exit command

Result without the fix: crash with segmentation fault on the following place in src/controller/CHIPDeviceController .cpp DeviceController::Shutdown()

chip::Platform::Delete(mDefaultIMDelegate);

Result with the fix: application tears down correctly and exits.

Copy link
Contributor

@erjiaqing erjiaqing left a comment

Choose a reason for hiding this comment

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

Thanks.

@andy31415
Copy link
Contributor

@bluebin14 - could you try making a change and re-updating this PR? Restyler seems stuck.

maybe the change could be to add more nullptr initializations as in my comment.

@bzbarsky-apple
Copy link
Contributor

@bluebin14 Needs rebase to tip to fix the Darwin failure...

@yunhanw-google
Copy link
Contributor

/rebase

@woody-apple woody-apple force-pushed the shutdown-crash-fix branch from 6dff033 to dcbf486 Compare June 2, 2021 01:04
@woody-apple woody-apple merged commit 7f03db9 into project-chip:master Jun 2, 2021
@bluebin14 bluebin14 deleted the shutdown-crash-fix branch June 26, 2021 12:57
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* Fix crash caused by uninitialized variable

* Initialize remaining member variables that are pointers

* changes by restyler
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.

chip-device-ctrl always crashes in DeviceController::Shutdown()
10 participants