-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive in resource leak checker when there is no catch block before finally block #4843
Comments
@Nargeshdb I'm guessing the void test2(@Owning InputStream in1, @Owning InputStream in2)
throws IOException {
try {
in1.close();
} finally {
in2.close();
}
} Can you confirm? I visualized the CFG for the simplified method above: The CFG looks correct to me, but I see a potential problem. In the RLC, we do not propagate obligations along exceptional edges corresponding to So, I wonder if at the entry of the @Nargeshdb @kelloggm what do you think? Any ideas on a fix? |
@msridhar your diagnosis looks right to me. We could add logic to the Called Methods Checker to handle this case without impacting its soundness: |
@msridhar you're right,
It looks right to me too. |
Yup this makes sense. For |
The following example shows a false positive in resource leak checker. The code closes
in1
andin2
on all paths in both tests but the checker reports a warning fortest2
. The only difference between this two tests is an empty catch block that shouldn't make any difference.The text was updated successfully, but these errors were encountered: