Commit 924d88bb authored by Cedric Roux's avatar Cedric Roux

bugfix: avoid a crash when oai_exit is set

There was a crash when we exit the nr softmodem with AW2S device.
The array rxbase[] was surely freed() by some other thread, so
let's not access it after detecting oai_exit != 0.

We also need to unblock a possible reader thread. The chosen way to
do may be not the best. To be checked.
parent 214aa505
......@@ -451,6 +451,11 @@ void *udp_read_thread(void *arg) {
buffer,sizeof(buffer),0,
(struct sockaddr *)&((eth_state_t*)device->priv)->dest_addrd,
(socklen_t *)&((eth_state_t*)device->priv)->addr_len);
/* if oai_exit is 1 here, don't access the array rxbase,
* it may have been freed(), so let's break at this point
*/
if (oai_exit)
break;
aid = *(uint16_t*)(&buffer[ECPRICOMMON_BYTES]);
TS = *(openair0_timestamp *)(&buffer[ECPRICOMMON_BYTES+ECPRIPCID_BYTES]);
// convert TS to samples, /6 for AW2S @ 30.72 Ms/s, this is converted for other sample rates in OAI application
......@@ -475,6 +480,11 @@ void *udp_read_thread(void *arg) {
}
sleep(1);
}
/* let's unblock reader (maybe not the best way to do it) */
fhstate->first_read = 0;
fhstate->r[0] = 1;
return(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment