Project

General

Profile

Actions

Bug #9393

closed

Problem with memleak visualization on absent return from void function

Added by Anton Vasilyev over 5 years ago. Updated over 4 years ago.

Status:
Rejected
Priority:
Urgent
Assignee:
-
Category:
Results processing
Target version:
Start date:
11/20/2018
Due date:
% Done:

0%

Estimated time:
Detected in build:
svn
Platform:
Published in build:

Description

For void functions with absent return:

/*
 * Use the Fisher-Yates shuffle algorithm on an array of lines.
 */
static void shuffle_lines(char **lines, unsigned numlines)
{
    unsigned i;
    unsigned r;
    char *tmp;

    srand(monotonic_us());

    for (i = numlines-1; i > 0; i--) {
        r = rand();
        /* RAND_MAX can be as small as 32767 */
        if (i > RAND_MAX)
            r ^= rand() << 15;
        r %= i + 1;
        tmp = lines[i];
        lines[i] = lines[r];
        lines[r] = tmp;
    }
}

SMG generates warning edge without source code like:

 <edge source="A85098" target="A85104">
   <data key="returnFrom">shuffle_lines</data>
   <data key="warning">Memory leak is detected</data>
 </edge>

Require to specify Klever and SMG interaction for this corner case.

Actions

Also available in: Atom PDF