AAC Decoder: Use osi_free() to free buffers allocated by osi_malloc()
* buffers allocated by osi_malloc() have canary bytes around it and need special method
osi_free() to free them
Bug: 148107188
Test: manual
Change-Id: Ifcfe494737c47e33755297214d3f637852a8be0b
(cherry picked from commit b88f8057fd28ca271ccd436a17f6489d4cf46697)
(cherry picked from commit 7a6fd5459ef8c6a2c21774e1220deb1023ae2935)
diff --git a/stack/a2dp/a2dp_aac_decoder.cc b/stack/a2dp/a2dp_aac_decoder.cc
index d9cd85d..d998d7d 100644
--- a/stack/a2dp/a2dp_aac_decoder.cc
+++ b/stack/a2dp/a2dp_aac_decoder.cc
@@ -30,7 +30,7 @@
typedef struct {
HANDLE_AACDECODER aac_handle;
bool has_aac_handle; // True if aac_handle is valid
- INT_PCM* decode_buf;
+ INT_PCM* decode_buf = nullptr;
decoded_data_callback_t decode_callback;
} tA2DP_AAC_DECODER_CB;
@@ -58,7 +58,7 @@
void a2dp_aac_decoder_cleanup(void) {
if (a2dp_aac_decoder_cb.has_aac_handle)
aacDecoder_Close(a2dp_aac_decoder_cb.aac_handle);
- free(a2dp_aac_decoder_cb.decode_buf);
+ osi_free(a2dp_aac_decoder_cb.decode_buf);
memset(&a2dp_aac_decoder_cb, 0, sizeof(a2dp_aac_decoder_cb));
}