From a96e94b8728cdedef5c46443b2c8fcae2ff69353 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 8 May 2020 21:13:01 +0200 Subject: [PATCH] coverity fix --- armsrc/lfsampling.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 2851dc08b..ae61aa612 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -110,24 +110,27 @@ void initSampleBuffer(uint32_t *sample_size) { } void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) { - + if (sample_size == NULL) { + Dbprintf("initSampleBufferEx, param NULL"); + return; + } BigBuf_free(); + // We can't erase the buffer now, it would drastically delay the acquisition if (use_malloc) { - if (sample_size == NULL || *sample_size == 0) { + if (*sample_size == 0) { *sample_size = BigBuf_max_traceLen(); data.buffer = BigBuf_get_addr(); } else { *sample_size = MIN(*sample_size, BigBuf_max_traceLen()); data.buffer = BigBuf_malloc(*sample_size); - } } else { - if (sample_size == NULL || *sample_size == 0) { + if (*sample_size == 0) { *sample_size = BigBuf_max_traceLen(); } data.buffer = BigBuf_get_addr();