From 2ffaf6b3f62bc112a38157a9a6f75eb72dddb021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20=C4=B0nan?= Date: Wed, 26 Oct 2011 20:39:47 +0200 Subject: [PATCH] free resources on EOF and set init = 0 in decode method --- decode.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/decode.c b/decode.c index 38ea1f9..3876439 100644 --- a/decode.c +++ b/decode.c @@ -357,8 +357,15 @@ int demodulate(pcm_t *pcm, float *cnt_freq, float *dat_freq, float *drate) if (out >= factor_L) { out = 0; - if (!read_pcm(pcm, buff, factor_M)) + if (!read_pcm(pcm, buff, factor_M)) { + init = 0; + free(buff); + free_ddc(cnt_ddc); + free_ddc(dat_ddc); + free(cnt_amp); + free(dat_amp); return 0; + } for (int j = 0; j < factor_M; j++) { float amp = (float)buff[j * channels] / 32767.0; cnt_amp[j] = do_delay(cnt_delay, amp);