aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tsou <ttsou@vt.edu>2012-03-16 20:26:46 -0400
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-06-24 01:51:02 +0400
commit507e6d4e12423c357c16aed25cd143e26b9d18cd (patch)
tree1fa809f2e787db70409a129eba38352bce443a66
parent1f330a9801861083e2cfec0e785b5a10e8dd5c48 (diff)
multi-arfcn, trx: only deallocate radio resouces if started
Certain notable variables - sample buffers - are not allocated until start(), which causes a segfault if the transceiver is shutdown without the radio starting. Check that the radio is 'started' before releasing in the destructor. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
-rw-r--r--Transceiver52M/radioInterface.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index 69c76ed..c1d43b6 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -71,13 +71,16 @@ RadioInterface::~RadioInterface(void)
{
int i;
- close();
-
- for (i = 0; i < CHAN_M; i++) {
- if (rcvBuffer[i] != NULL)
- delete rcvBuffer[i];
- if (sendBuffer[i] != NULL)
- delete sendBuffer[i];
+ if (mOn) {
+ mRadio->stop();
+ close();
+
+ for (i = 0; i < CHAN_M; i++) {
+ if (rcvBuffer[i] != NULL)
+ delete rcvBuffer[i];
+ if (sendBuffer[i] != NULL)
+ delete sendBuffer[i];
+ }
}
}