diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-26 10:50:16 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-08-26 10:50:20 +0200 |
commit | ca6a78e1938a0b0247fea9f5f2b5162637ab7502 (patch) | |
tree | 1f0bffaf07ba4efcab1bcc5b3023fe40cfbbd5e8 /Transceiver52M | |
parent | 67aa91b2c0e7a06873e0c42f3e7088c6ce56d178 (diff) |
Transceiver: fix segfault during init if IP addr binding fails
If osmo-trx is started and IP addr binding fails (ie because the IP
address is not assigned in the system), it will try to access a
heap-allocated Thread instance which was not initialized (because init()
function returned earlier).
Fixes: OS#4147
Change-Id: I19f9745cd026c0ff6581895a66bf91b40113b07d
Diffstat (limited to 'Transceiver52M')
-rw-r--r-- | Transceiver52M/Transceiver.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp index 2d5c04e..e946aac 100644 --- a/Transceiver52M/Transceiver.cpp +++ b/Transceiver52M/Transceiver.cpp @@ -151,9 +151,11 @@ Transceiver::~Transceiver() close(mClockSocket); for (size_t i = 0; i < mChans; i++) { - mControlServiceLoopThreads[i]->cancel(); - mControlServiceLoopThreads[i]->join(); - delete mControlServiceLoopThreads[i]; + if (mControlServiceLoopThreads[i]) { + mControlServiceLoopThreads[i]->cancel(); + mControlServiceLoopThreads[i]->join(); + delete mControlServiceLoopThreads[i]; + } mTxPriorityQueues[i].clear(); if (mCtrlSockets[i] >= 0) |