[LLVMbugs] [Bug 15374] New: False positive on strsep function call

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 27 03:12:49 PST 2013


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: kremenek at apple.com
          Reporter: jeremy.hustache-mathieu at netasq.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130227/3721887a/attachment.html>


More information about the llvm-bugs mailing list