OSDN Git Service

Fix GKI exception of calling free on an already freed buffer
authorMike J. Chen <mjchen@google.com>
Tue, 25 Feb 2014 02:07:14 +0000 (18:07 -0800)
committerMike J. Chen <mjchen@google.com>
Wed, 5 Mar 2014 01:20:10 +0000 (17:20 -0800)
commitbe6d58f35e66b9e57cf4978be68840cbc8ac2fc9
tree1ee680a539528d3b263a0ca88155b9944610c60f
parentf9c6502a109b0506916969fe016148bd6addf129
Fix GKI exception of calling free on an already freed buffer

Various parts of btif_hh.c were creating GKI buffers and
keeping references to them and freeing them in odd and
unnecessary ways.  The buffer is freed by lower levels
of the stack once the buffer has been sent to the chip
at the l2c layer and shouldn't be freed by btif_hh itself
since it's possible to double free, and there could
also be race conditions with other threads already processing
the buffer while the reference is freed if the API calls
are invoked again before the previous invocation was completely
processed.

Also added a helper routine to simplify buffer creation and
initialization.

Change-Id: Ia6039983502e2670b2325d90310244edf843b692
Signed-off-by: Mike J. Chen <mjchen@google.com>
btif/include/btif_hh.h
btif/src/btif_hh.c