<div dir="ltr">Hi,<div><br></div><div>I am new to clang and I am developing a checker to detect resource leaks that is similar to the <span style="color:rgb(0,0,0);white-space:pre-wrap">SimpleStreamChecker</span> except that the target function is passing its return value through parameters. The example code would be like:<br></div><div><br></div><div><div>int request(int * arg1, int * arg2);</div><div>int release(int arg1);</div></div><div>void foo() {</div><div>   int fd1 = 0, fd2 = 0;</div><div>   </div><div>   request(&fd1, &fd2);</div><div><br></div><div>   // ..... some unrelated code</div><div><br></div><div>   release(fd1);</div><div>   release(fd2);</div><div>}</div><div><br></div><div><br></div><div>Here, the integer fd1 and fd2 are resource descriptors that should be assigned with unique integer values after the "request(&fd1, &fd2)" call. The resource will be leaked if someone forgot to call "release(fd)" on a resource descriptor.</div><div><br></div><div>The problem is , if I use the "Call.getArgSVal(0)" on the calls to  the "release(fd1)" or "release(fd2)"  function, I only get a "ConcreteInt" which is the value "0" that I assigned in the initializer instead of a SVal with a SymbolRef. In this case, I cannot determine if the value in "fd1" is the same value that is assigned after the call to the "request(&fd1, &fd2)".</div><div><br></div><div><div>The original <span style="color:rgb(0,0,0);white-space:pre-wrap">SimpleStreamChecker does not have this issue because the </span>file descriptor (to be precise, it is FILE *) used in "FILE *F = fopen("mylog.txt", "w");" is passed through the return value instead of parameter. In this case, clang will allocate a SymbolRef for "F". And it will be the same one if I call "Call.getReturnValue().getAsSymbol()" on a "fclose(F)".</div></div><div><br></div><div>My question is, is there anyway to allocate SymbolRef to the variables pointed by arg1 and arg2 manually in the checkPreCall for the "int request(int * arg1, int * arg2)"? So in checkPostCall for "int release(int arg1);" I can use "Call.getReturnValue().getAsSymbol()" to check if the SymbolRef of "arg1" is the same one that allocated in "int request(int * arg1, int * arg2)"?</div><div><br></div><div>Thanks for any help,</div><div>Haowei</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div>