@@ -140,12 +140,12 @@ class Resource extends MemberVariable {
140140 )
141141 }
142142
143- predicate acquisitionWithRequiredRelease ( Assignment acquireAssign , string kind ) {
143+ predicate acquisitionWithRequiredKind ( Assignment acquireAssign , string kind ) {
144144 // acquireAssign is an assignment to this resource
145145 acquireAssign .( Assignment ) .getLValue ( ) = this .getAnAccess ( ) and
146146 // Should be in this class, but *any* member method will do
147147 this .inSameClass ( acquireAssign ) and
148- // Check that it is an acquisition function and return the corresponding free
148+ // Check that it is an acquisition function and return the corresponding kind
149149 acquireExpr ( acquireAssign .getRValue ( ) , kind )
150150 }
151151
@@ -158,10 +158,10 @@ predicate unreleasedResource(Resource r, Expr acquire, File f, int acquireLine)
158158 // Note: there could be several release functions, because there could be
159159 // several functions called 'fclose' for example. We want to check that
160160 // *none* of these functions are called to release the resource
161- r .acquisitionWithRequiredRelease ( acquire , _) and
162- not exists ( Expr releaseExpr , string releaseName |
163- r .acquisitionWithRequiredRelease ( acquire , releaseName ) and
164- releaseExpr = r .getAReleaseExpr ( releaseName ) and
161+ r .acquisitionWithRequiredKind ( acquire , _) and
162+ not exists ( Expr releaseExpr , string kind |
163+ r .acquisitionWithRequiredKind ( acquire , kind ) and
164+ releaseExpr = r .getAReleaseExpr ( kind ) and
165165 r .inDestructor ( releaseExpr )
166166 )
167167 and f = acquire .getFile ( )
@@ -181,9 +181,9 @@ predicate unreleasedResource(Resource r, Expr acquire, File f, int acquireLine)
181181
182182predicate freedInSameMethod ( Resource r , Expr acquire ) {
183183 unreleasedResource ( r , acquire , _, _) and
184- exists ( Expr releaseExpr , string releaseName |
185- r .acquisitionWithRequiredRelease ( acquire , releaseName ) and
186- releaseExpr = r .getAReleaseExpr ( releaseName ) and
184+ exists ( Expr releaseExpr , string kind |
185+ r .acquisitionWithRequiredKind ( acquire , kind ) and
186+ releaseExpr = r .getAReleaseExpr ( kind ) and
187187 releaseExpr .getEnclosingFunction ( ) = acquire .getEnclosingFunction ( )
188188 )
189189}
@@ -224,10 +224,10 @@ predicate leakedInSameMethod(Resource r, Expr acquire) {
224224
225225pragma [ noopt] predicate badRelease ( Resource r , Expr acquire , Function functionCallingRelease , int line ) {
226226 unreleasedResource ( r , acquire , _, _) and
227- exists ( Expr releaseExpr , string releaseName ,
227+ exists ( Expr releaseExpr , string kind ,
228228 Location releaseExprLocation , Function acquireFunction |
229- r .acquisitionWithRequiredRelease ( acquire , releaseName ) and
230- releaseExpr = r .getAReleaseExpr ( releaseName ) and
229+ r .acquisitionWithRequiredKind ( acquire , kind ) and
230+ releaseExpr = r .getAReleaseExpr ( kind ) and
231231 releaseExpr .getEnclosingFunction ( ) = functionCallingRelease and
232232 functionCallingRelease .getDeclaringType ( ) = r .getDeclaringType ( ) and
233233 releaseExprLocation = releaseExpr .getLocation ( ) and
0 commit comments