[llvm-bugs] [Bug 33110] New: Misleading warning

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 20 00:10:31 PDT 2017


            Bug ID: 33110
           Summary: Misleading warning
           Product: clang
           Version: 4.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: dilyan.palauzov at aegee.org
                CC: llvm-bugs at lists.llvm.org

For this code:

#include <stdlib.h>
#include <stdio.h>

int main() {
  char *p, *z = malloc(4);
  sprintf(z, "%s", "abc");
  for (p = z; *p; p++);
  return 0;

the output is

t.c:8:10: warning: Potential leak of memory pointed to by 'p'
  return 0;

but should be "Potential leak of memory pointed to by 'z'".

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/20170520/7c2cca9a/attachment-0001.html>

More information about the llvm-bugs mailing list