fix various coverity bugs

master
Andre Puschmann 7 years ago
parent ee12051b33
commit ccfb9314bc

@ -54,7 +54,7 @@ void logger_file::init(std::string file, int max_length_) {
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&not_empty, NULL);
pthread_cond_init(&not_full, NULL);
max_length = max_length_*1024;
max_length = (int64_t)max_length_*1024;
name_idx = 0;
filename = file;
logfile = fopen(filename.c_str(), "w");

@ -54,6 +54,7 @@ int srslte_ringbuffer_write(srslte_ringbuffer_t *q, void *p, int nof_bytes)
int w_bytes = nof_bytes;
pthread_mutex_lock(&q->mutex);
if (!q->active) {
pthread_mutex_unlock(&q->mutex);
return 0;
}
if (q->count + w_bytes > q->capacity) {
@ -85,6 +86,7 @@ int srslte_ringbuffer_read(srslte_ringbuffer_t *q, void *p, int nof_bytes)
pthread_cond_wait(&q->cvar, &q->mutex);
}
if (!q->active) {
pthread_mutex_unlock(&q->mutex);
return 0;
}
if (nof_bytes + q->rpm > q->capacity) {

@ -1085,11 +1085,11 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes)
it = tx_window.find(i);
if (it != tx_window.end()) {
if(update_vt_a) {
tx_window.erase(it);
if(it->second.buf) {
pool->deallocate(it->second.buf);
it->second.buf = 0;
}
tx_window.erase(it);
vt_a = (vt_a + 1)%MOD;
vt_ms = (vt_ms + 1)%MOD;
}

@ -47,6 +47,7 @@ public:
rlc2 = rlc2_;
fail_rate = fail_rate_;
run_enable = true;
running = false;
}
void stop()

@ -76,17 +76,22 @@ class cell_t
return false;
}
cell_t() {
this->has_valid_sib1 = false;
this->has_valid_sib2 = false;
this->has_valid_sib3 = false;
srslte_cell_t tmp = {};
cell_t(tmp, 0, 0);
}
cell_t(srslte_cell_t phy_cell, uint32_t earfcn, float rsrp) {
this->has_valid_sib1 = false;
this->has_valid_sib2 = false;
this->has_valid_sib3 = false;
this->has_valid_sib13 = false;
this->phy_cell = phy_cell;
this->rsrp = rsrp;
this->earfcn = earfcn;
in_sync = false;
bzero(&sib1, sizeof(sib1));
bzero(&sib2, sizeof(sib2));
bzero(&sib3, sizeof(sib3));
bzero(&sib13, sizeof(sib13));
}
uint32_t earfcn;
@ -114,6 +119,7 @@ class rrc
{
public:
rrc();
~rrc();
void init(phy_interface_rrc *phy_,
mac_interface_rrc *mac_,

@ -49,12 +49,20 @@ rrc::rrc()
:state(RRC_STATE_IDLE)
,drb_up(false)
,sysinfo_index(0)
,serving_cell(NULL)
{
n310_cnt = 0;
n311_cnt = 0;
serving_cell = new cell_t();
}
rrc::~rrc()
{
if (serving_cell) {
delete(serving_cell);
}
}
static void liblte_rrc_handler(void *ctx, char *str) {
rrc *r = (rrc *) ctx;
r->liblte_rrc_log(str);

Loading…
Cancel
Save