From 42254e62672f9e8d5eef37f9756518b6fc548b0a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 18 Apr 2024 00:25:22 +0200 Subject: [PATCH] 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). --- radio/rfsimulator/simulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/radio/rfsimulator/simulator.c b/radio/rfsimulator/simulator.c index 62d08da212..d190851699 100644 --- a/radio/rfsimulator/simulator.c +++ b/radio/rfsimulator/simulator.c @@ -179,7 +179,7 @@ typedef struct { static int allocCirBuf(rfsimulator_state_t *bridge, int sock) { buffer_t *ptr=&bridge->buf[sock]; - ptr->circularBuf = malloc(sampleToByte(CirSize, 1)); + ptr->circularBuf = calloc(1, sampleToByte(CirSize, 1)); if (ptr->circularBuf == NULL) { LOG_E(HW, "malloc(%lu) failed\n", sampleToByte(CirSize, 1)); return -1;