diff options
author | Andreas Eversberg <jolly@eversberg.eu> | 2013-06-20 10:42:57 +0200 |
---|---|---|
committer | Andreas Eversberg <jolly@eversberg.eu> | 2013-06-20 10:42:57 +0200 |
commit | 95abd4e12c4dc87dbf39d8f9542b2b509f2352dc (patch) | |
tree | e4545937ebb5abdf9aa88d7d5082bb50411cea07 | |
parent | a19bce8f22c34c4aa690819905e16a673b35efb4 (diff) |
host/transceiver: Fix leak in AB processing codepath
Thanks to Andreas for pointing this out
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | src/host/layer23/src/transceiver/demod.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/host/layer23/src/transceiver/demod.c b/src/host/layer23/src/transceiver/demod.c index c7a2d15f..d21f112f 100644 --- a/src/host/layer23/src/transceiver/demod.c +++ b/src/host/layer23/src/transceiver/demod.c @@ -24,6 +24,8 @@ #include <stdio.h> #include <stdint.h> #include <string.h> +#include <stdlib.h> +#include <errno.h> #include <osmocom/dsp/cxvec.h> #include <osmocom/dsp/cxvec_math.h> @@ -65,16 +67,20 @@ gsm_ab_ind_process(struct app_state *as, goto err; /* Check for a significant peak */ - if (cabsf(chan) < 0.5) + if (cabsf(chan) < 0.5) { + rv = -EINVAL; goto err; + } printf("TOA : %f\n", toa); printf("chan : (%f %f) => %f\n", crealf(chan), cimagf(chan), cabsf(chan)); /* Demodulate */ bits = gsm_ab_demodulate(as->gs, burst, chan, toa); - if (!bits) + if (!bits) { + rv = -ENOMEM; goto err; + } /* Copy */ memset(data, 0x00, 148); @@ -87,8 +93,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; } |