From 318e4a345ec29d69837009d55395c44dfe666f1a Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Tue, 20 Mar 2018 14:41:58 +0100
Subject: [PATCH] free configmodule memory when shutting down

It is possible to restart the lte-softmodem via the FlexRAN controller. For
this to work, the end_configmodule() method needs to be called when shutting
the lte-softmodem down so that the configuration can be read again during a
restart.
---
 targets/RT/USER/lte-softmodem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 03313146df..29bbf44756 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1209,9 +1209,6 @@ int main( int argc, char **argv )
   sync_var=0;
   pthread_cond_broadcast(&sync_cond);
   pthread_mutex_unlock(&sync_mutex);
-  printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
-  end_configmodule();
-  printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
 
   // wait for end of program
   printf("TYPE <CTRL-C> TO TERMINATE\n");
@@ -1271,6 +1268,9 @@ int main( int argc, char **argv )
     }
     free_lte_top();
 
+  printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
+  end_configmodule();
+  printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
 
   pthread_cond_destroy(&sync_cond);
   pthread_mutex_destroy(&sync_mutex);
-- 
GitLab