facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.79k stars 2k forks source link

version 1.2.0 cannot check resource leak by using pulse(biabduction is deprecated) #1845

Open u201111476 opened 1 week ago

u201111476 commented 1 week ago

I have a file named main.c with some code like this:

#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>

int main(int argc, char * argv[])
{
   int data;
    data = -1;
    data = open("BadSource_open.txt", O_RDWR|O_CREAT, S_IREAD|S_IWRITE);
    FILE* data2=fopen("2.txt","r");
  return 0;
}

then I use infer capture -- gcc main.c and infer analyze --pulse,no resource leak result is shown,why?

Coronon commented 6 days ago

Same for Java (17) on Apple Silicon M2:

public String test() throws IOException {
    FileOutputStream file = new FileOutputStream("test.txt");
    file.write("Some String".getBytes());
    return "";
}

will not yield any issues when tested with:

infer run --no-filtering -- javac MyFile.java