amrnb: Fix memory leaks
This fixes two independent memory leaks.
The one in sp_dec also replaces apparently broken (and dynamically dead)
code. Decoder_amr_init and Post_Process_reset can apparently only fail
if you pass them null pointers. In any case, `GSMDecodeFrameExit(s)`
basically does `free(*s)` if `(s != NULL && *s != NULL)`; as written,
we'll free the first *member* of `tmp` in the old block here, and leave
the original allocation unfreed.
Reported by the static analyzer:
frameworks/av/media/libstagefright/codecs/amrnb/common/src/lsp.cpp:185:17:
warning: Potential leak of memory pointed to by 's'
[clang-analyzer-unix.Malloc]
frameworks/av/media/libstagefright/codecs/amrnb/dec/src/sp_dec.cpp:278:9:
warning: Potential leak of memory pointed to by 'tempVoid'
[clang-analyzer-unix.Malloc]
Bug: None
Test: Built again with the analyzer
Change-Id: Idcbd8fb98259693df5ecce14583367b98c9fe1d7
2 files changed