diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2013-06-20 09:59:46 +0200 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2014-06-15 19:30:52 +0200 |
commit | 9ec3f72277f4f3c96ac365de3022f4d181ba8c9f (patch) | |
tree | 59d0983498a749d3c5281dc57959812754928cdb | |
parent | 047fe738637b73ef4917352cb4b200f033070a4b (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 | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/host/layer23/src/transceiver/demod.c b/src/host/layer23/src/transceiver/demod.c index 45b0570a..98a76c6b 100644 --- a/src/host/layer23/src/transceiver/demod.c +++ b/src/host/layer23/src/transceiver/demod.c @@ -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; } |