diff options
| author | Luca Trisciani <luca.trisciani@gmail.com> | 2018-03-23 22:16:54 +0100 |
|---|---|---|
| committer | Luca Trisciani <luca.trisciani@gmail.com> | 2018-03-23 22:16:54 +0100 |
| commit | f2a710eebcd4992291dcb43e9827f74994ea49aa (patch) | |
| tree | 1b3535ac9259bc2f363f19cc0c8783606429dcd1 | |
| parent | 8292995caa014b06a1b7d4c2db518bbf0cdf0cd7 (diff) | |
Memory leaks fixed.
| -rw-r--r-- | src/leqm-nrt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/leqm-nrt.c b/src/leqm-nrt.c index cec1cf0..45272a0 100644 --- a/src/leqm-nrt.c +++ b/src/leqm-nrt.c @@ -327,7 +327,7 @@ int main(int argc, const char ** argv) */ double * buffer; // buffer = new double [BUFFER_LEN]; - buffersizesamples = (sfinfo.samplerate*sfinfo.channels*buffersizems)/1000; + //buffersizesamples = (sfinfo.samplerate*sfinfo.channels*buffersizems)/1000; if ((sfinfo.samplerate*buffersizems)%1000) { printf("Please fine tune the buffersize according to the sample rate\n"); //close file @@ -469,6 +469,8 @@ int main(int argc, const char ** argv) //maybe here wait for all cores to output before going on for (int idxcpu = 0; idxcpu < numCPU; idxcpu++) { pthread_join(tid[idxcpu], NULL); + free(WorkerArgsArray[idxcpu]->argbuffer); + WorkerArgsArray[idxcpu]->argbuffer = NULL; free(WorkerArgsArray[idxcpu]); WorkerArgsArray[idxcpu] = NULL; } @@ -490,6 +492,8 @@ int main(int argc, const char ** argv) if (worker_id != 0) { // worker_id = 0 means the number of samples was divisible through the number of cpus for (int idxcpu = 0; idxcpu < worker_id; idxcpu++) { //worker_id is at this point one unit more than threads launched pthread_join(tid[idxcpu], NULL); + free(WorkerArgsArray[idxcpu]->argbuffer); + WorkerArgsArray[idxcpu]->argbuffer = NULL; free(WorkerArgsArray[idxcpu]); WorkerArgsArray[idxcpu] = NULL; } |
