[LLVMbugs] [Bug 17596] New: False positive "Potential leak of memory pointed to by"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 16 01:33:32 PDT 2013


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

            Bug ID: 17596
           Summary: False positive "Potential leak of memory pointed to
                    by"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: bjorn.topel at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following code:
$ cat minimal.c
#include <string.h>

union u {
    int i;
    char *s;
};

void f(union u uu);

void g(void)
{
    union u uu;
    uu.s = strdup("");
    f(uu);
}

$ scan-build clang -Wall -c minimal.c -o minimal.o
yields:
scan-build: Using '/usr/bin/clang' for static analysis
minimal.c:14:2: warning: Potential leak of memory pointed to by 'uu.s'
        f(uu);
        ^~~~~
1 warning generated.
scan-build: 1 bugs found.

f will take ownership of the pointer.

-- 
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/20131016/2b2014f5/attachment.html>


More information about the llvm-bugs mailing list