From b0430ebfe223415aa0bbfa243daad87234f28626 Mon Sep 17 00:00:00 2001 From: Robert Falkenberg Date: Wed, 6 Oct 2021 14:53:27 +0200 Subject: [PATCH] rf_imp.c: fix segfault when closing RF device with no AGC thread --- lib/src/phy/rf/rf_imp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/phy/rf/rf_imp.c b/lib/src/phy/rf/rf_imp.c index bccfe5758..f7b55a502 100644 --- a/lib/src/phy/rf/rf_imp.c +++ b/lib/src/phy/rf/rf_imp.c @@ -181,7 +181,9 @@ int srsran_rf_close(srsran_rf_t* rf) } pthread_mutex_unlock(&rf->mutex); pthread_cond_signal(&rf->cond); - pthread_join(rf->thread_gain, NULL); + if (rf->thread_gain) { + pthread_join(rf->thread_gain, NULL); + } return ((rf_dev_t*)rf->dev)->srsran_rf_close(rf->handler); }