http://llvm.org/bugs/show_bug.cgi?id=15374

            Bug ID: 15374
           Summary: False positive on strsep function call
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

We implement the following use case of strsep() function:

char *my_function(const char *conf)
{
    char *cert, *ca;

    if (conf == NULL)
        return NULL;

    cert = strdup(conf);
    if (cert == NULL)
        return NULL;

    ca = strsep(&cert, g_sep);
6 ← Memory is never released; potential leak of memory pointed to by 'cert'

    if (cert == NULL)
    {
        free(ca);
        return NULL;
    }

...

    free(ca);
    return (cert);
}


We have a false positive alert after the call of strsep(). The memory pointed
by cert (which is pointed also by ca) is well-released.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to