Commit 42254e62 authored by Robert Schmidt's avatar Robert Schmidt

Memory sanitizer: unitialized read

Reset all the circular buffer to zero; this ensures that we cannot read
uninitialized data. Since this is RFsimulator, performance is not a
problem here either (and zeroing out happens only once).
parent c114d2f5
...@@ -179,7 +179,7 @@ typedef struct { ...@@ -179,7 +179,7 @@ typedef struct {
static int allocCirBuf(rfsimulator_state_t *bridge, int sock) static int allocCirBuf(rfsimulator_state_t *bridge, int sock)
{ {
buffer_t *ptr=&bridge->buf[sock]; buffer_t *ptr=&bridge->buf[sock];
ptr->circularBuf = malloc(sampleToByte(CirSize, 1)); ptr->circularBuf = calloc(1, sampleToByte(CirSize, 1));
if (ptr->circularBuf == NULL) { if (ptr->circularBuf == NULL) {
LOG_E(HW, "malloc(%lu) failed\n", sampleToByte(CirSize, 1)); LOG_E(HW, "malloc(%lu) failed\n", sampleToByte(CirSize, 1));
return -1; return -1;
......
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