Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 639b12e3 authored by George Burgess IV's avatar George Burgess IV
Browse files

avdt_scb: fix dereferences of NULL

A recent change to this code added `int` in this for loop's first clause
(good, since that's way more common than declaring `i` outside of the
loop). Unfortunately, this caused the `*p_err_code = 0` to be
interpreted as "create a new int* called p_err_code and set it to 0,"
rather than "set the value pointed to by p_err_code to 0."

Caught by clang's static analyzer:

> system/bt/stack/avdt/avdt_scb.cc:936:19: warning: Dereference of null
pointer (loaded from variable 'p_err_code')
[clang-analyzer-core.NullDereference]>
system/bt/stack/avdt/avdt_scb.cc:941:19: warning: Dereference of null
pointer (loaded from variable 'p_err_code')
[clang-analyzer-core.NullDereference] >
system/bt/stack/avdt/avdt_scb.cc:946:19: warning: Dereference of null
pointer (loaded from variable 'p_err_code')
[clang-analyzer-core.NullDereference] >
system/bt/stack/avdt/avdt_scb.cc:955:23: warning: Dereference of null
pointer (loaded from variable 'p_err_code')
[clang-analyzer-core.NullDereference] >
system/bt/stack/avdt/avdt_scb.cc:963:23: warning: Dereference of null
pointer (loaded from variable 'p_err_code')
[clang-analyzer-core.NullDereference]

Bug: 180421437
Test: TreeHugger
Change-Id: I834032e22da0ed558c25355c9d1cf20c11c8c530
parent d468f80c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment