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

nimble/host: NULL assign data pointer after free #1792

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rahult-github
Copy link
Contributor

After buffer is freed, explicitly NULL assign the pointer to data.

@rahult-github
Copy link
Contributor Author

@sjanc Please take a look and review

Copy link
Contributor

@sjanc sjanc left a comment

Choose a reason for hiding this comment

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

Hi,

I'm not sure what this patch fix, data is local pointer

@rahult-github
Copy link
Contributor Author

rahult-github commented Jun 4, 2024

Hi @sjanc ,

So data here is the pointer which is passed as parameter to ble_gap_ext_adv_set_data. Apps like bleprph, create a data pointer, allocate it and then invoke ble_gap_ext_adv_set_data . Since the function does have the code to free the "os_mbuf *data" , this change is to also NULL initialize it.

@andrzej-kaczmarek
Copy link
Contributor

andrzej-kaczmarek commented Jun 4, 2024

you set local variable literally just before returning from function. that is just pointless.

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

Successfully merging this pull request may close these issues.

3 participants