apache / mynewt-nimble

Apache mynewt
https://mynewt.apache.org/
Apache License 2.0
691 stars 394 forks source link

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

Open rahult-github opened 4 months ago

rahult-github commented 4 months ago

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

rahult-github commented 4 months ago

@sjanc Please take a look and review

rahult-github commented 4 months ago

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 commented 4 months ago

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