echo-cancel: Fix a crash is speex cleanup

If module initialisation fails, the speex done() function might try to
free a value that's not been allocated yet. Adding protection for this
condition.
This commit is contained in:
Arun Raghavan 2011-05-28 07:51:35 +05:30
parent 9e78de2da2
commit b0f5b8d2fa

View file

@ -109,6 +109,7 @@ void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *p
}
void pa_speex_ec_done(pa_echo_canceller *ec) {
speex_echo_state_destroy(ec->params.priv.speex.state);
if (ec->params.priv.speex.state)
speex_echo_state_destroy(ec->params.priv.speex.state);
ec->params.priv.speex.state = NULL;
}