mirror of https://github.com/PentHertz/srsLTE.git
fix mem leak in radio
This commit is contained in:
parent
b6bb8cb125
commit
4655ad92fe
|
@ -39,7 +39,8 @@ namespace srslte {
|
|||
*/
|
||||
class radio {
|
||||
public:
|
||||
radio() : tr_local_time(1024 * 10), tr_usrp_time(1024 * 10), tr_tx_time(1024 * 10), tr_is_eob(1024 * 10) {
|
||||
radio() : tr_local_time(1024 * 10), tr_usrp_time(1024 * 10), tr_tx_time(1024 * 10), tr_is_eob(1024 * 10), zeros(NULL)
|
||||
{
|
||||
bzero(&rf_device, sizeof(srslte_rf_t));
|
||||
bzero(&end_of_burst_time, sizeof(srslte_timestamp_t));
|
||||
zeros = (cf_t*)srslte_vec_malloc(burst_preamble_max_samples * sizeof(cf_t));
|
||||
|
@ -65,6 +66,13 @@ class radio {
|
|||
continuous_tx = false;
|
||||
};
|
||||
|
||||
~radio()
|
||||
{
|
||||
if (zeros) {
|
||||
free(zeros);
|
||||
}
|
||||
}
|
||||
|
||||
bool init(char *args = NULL, char *devname = NULL, uint32_t nof_channels = 1);
|
||||
void stop();
|
||||
void reset();
|
||||
|
|
|
@ -81,9 +81,6 @@ bool radio::is_init() {
|
|||
|
||||
void radio::stop()
|
||||
{
|
||||
if (zeros) {
|
||||
free(zeros);
|
||||
}
|
||||
if (is_initialized) {
|
||||
srslte_rf_close(&rf_device);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue