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 Platform::New to return nullptr on failure #5008

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

kpschoedel
Copy link
Contributor

Problem

Platform::New() uses placement new into a possibly-null pointer.

Summary of Changes

Check the return value of MemoryAlloc before using it.

Fixes #4998 platform::New will crash or do other bad things on allocation failure

#### Problem

`Platform::New()` uses placment `new` into a possibly-null pointer.

#### Summary of Changes

Check it.

Fixes project-chip#4998 platform::New will crash or do other bad things on allocation failure
@github-actions
Copy link

Size increase report for "gn_qpg6100-example-build" from 2891d6b

File Section File VM
chip-qpg6100-lock-example.out .text 32 32
Full report output
BLOAT REPORT

Files found only in the build output:
    report.csv

Comparing ./master_artifact/chip-qpg6100-lock-example.out and ./pull_artifact/chip-qpg6100-lock-example.out:

sections,vmsize,filesize
.debug_loc,0,473
.debug_info,0,392
.debug_line,0,48
.debug_abbrev,0,41
.text,32,32
.debug_str,0,-2
[Unmapped],0,-32
.debug_ranges,0,-96


@andy31415 andy31415 merged commit 3eddc00 into project-chip:master Feb 25, 2021
@kpschoedel kpschoedel deleted the 4998-new branch February 25, 2021 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

platform::New will crash or do other bad things on allocation failure
5 participants