From 9a5d17d967b50fe7cf14804860a6d0d134c8cb3b Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 16 Feb 2017 15:37:56 +0100
Subject: [PATCH] bugfix: do not allocate memory

Memory was allocated which was "lost" because the
address of the block was put in a pointer that is
overwritten just after.

Discussing with Elena, the current commit is the correct
way to do things.
---
 openair1/SIMULATION/TOOLS/random_channel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c
index abf7ab8954e..ea8781e2169 100644
--- a/openair1/SIMULATION/TOOLS/random_channel.c
+++ b/openair1/SIMULATION/TOOLS/random_channel.c
@@ -119,8 +119,9 @@ void fill_channel_desc(channel_desc_t *chan_desc,
   else {
     chan_desc->R_sqrt = (struct complex**) calloc(nb_taps,sizeof(struct complex*));
     for (i = 0; i<nb_taps; i++) {
-        chan_desc->R_sqrt[i]    = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
+        //chan_desc->R_sqrt[i]    = (struct complex*) calloc(nb_tx*nb_rx*nb_tx*nb_rx,sizeof(struct complex));
         //chan_desc->R_sqrt = (struct complex*)&R_sqrt[i][0];
+        /* all chan_desc share the same R_sqrt, coming from caller */
         chan_desc->R_sqrt[i] = R_sqrt[0];
         }
   }
-- 
GitLab