From 655ca10a708318bb22023146fe3dc338d25b777d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 17 Jan 2020 21:02:00 -0800 Subject: [PATCH] lib/memcpy: Suppress a Coverity leak report for setup_tests() Suppress the following Coverity memory leak complaint: CID 169324 (#1 of 1): Resource leak (RESOURCE_LEAK) 7. leaked_storage: Variable src going out of scope leaks the storage it points to. Signed-off-by: Bart Van Assche --- lib/memcpy.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/memcpy.c b/lib/memcpy.c index cf8572e270..a552134357 100644 --- a/lib/memcpy.c +++ b/lib/memcpy.c @@ -201,6 +201,9 @@ static int setup_tests(void) void *src, *dst; int i; + if (!tests[0].name) + return 0; + src = malloc(BUF_SIZE); dst = malloc(BUF_SIZE); if (!src || !dst) {