Merge "amrnb: Fix memory leaks" am: beb800f0c7 am: 7521f507c5

am: a6665ce480

Change-Id: I99293013025b19c9b898ae461689d12df85073be
gugelfrei
George Burgess IV 5 years ago committed by android-build-merger
commit 11df024f9e

@ -173,7 +173,7 @@ Word16 lsp_init(lspState **st)
*st = NULL;
/* allocate memory */
if ((s = (lspState *) malloc(sizeof(lspState))) == NULL)
if ((s = (lspState *) calloc(sizeof(lspState), 1)) == NULL)
{
/* fprintf(stderr, "lsp_init: can not malloc state structure\n"); */
return -1;
@ -182,11 +182,13 @@ Word16 lsp_init(lspState **st)
/* Initialize quantization state */
if (0 != Q_plsf_init(&s->qSt))
{
lsp_exit(&s);
return -1;
}
if (0 != lsp_reset(s))
{
lsp_exit(&s);
return -1;
}

@ -268,13 +268,7 @@ Word16 GSMInitDecode(void **state_data,
if (Decoder_amr_init(&s->decoder_amrState)
|| Post_Process_reset(&s->postHP_state))
{
Speech_Decode_FrameState *tmp = s;
/*
* dereferencing type-punned pointer avoid
* breaking strict-aliasing rules
*/
void** tempVoid = (void**) tmp;
GSMDecodeFrameExit(tempVoid);
free(s);
return (-1);
}

Loading…
Cancel
Save