host/transceiver: Fix leak in AB processing codepath

Thanks to Andreas for pointing this out

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
This commit is contained in:
Sylvain Munaut 2013-06-20 09:59:46 +02:00
parent 047fe73863
commit 9ec3f72277
1 changed files with 11 additions and 3 deletions

View File

@ -21,8 +21,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <osmocom/dsp/cxvec.h>
@ -69,8 +71,10 @@ gsm_ab_ind_process(struct app_state *as,
/* Demodulate */
bits = gsm_ab_demodulate(as->gs, burst, chan, toa);
if (!bits)
if (!bits) {
rv = -ENOMEM;
goto err;
}
/* Copy */
memset(data, 0x00, 148);
@ -83,8 +87,12 @@ gsm_ab_ind_process(struct app_state *as,
*toa_p = toa;
return 0;
rv = 0;
/* Cleanup */
err:
return -1;
free(bits);
osmo_cxvec_free(burst);
return rv;
}