lib/memcpy: Suppress a Coverity leak report for setup_tests()
authorBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 05:02:00 +0000 (21:02 -0800)
committerBart Van Assche <bvanassche@acm.org>
Sat, 18 Jan 2020 06:04:39 +0000 (22:04 -0800)
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 <bvanassche@acm.org>
lib/memcpy.c

index cf8572e270898a14c3fb3daf8be047c3bbcedd1c..a552134357131e2e2438deb44764fc61b6ec06be 100644 (file)
@@ -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) {