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

            Bug ID: 16731
           Summary: Static analyzer does not track pointer values across
                    memcpy
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

$ cat leak.c
#include <stdlib.h>

char *f() {
  void *x = malloc(47);
  char *a;
  memcpy(&a, &x, sizeof a);
  return a;
}
$ clang --analyze leak.c
leak.c:7:3: warning: Potential leak of memory pointed to by 'x'
  return a;
  ^~~~~~~~
1 warning generated.


This warning should not be reported, as the allocated memory is still
accessible using the return value of the function.

-- 
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