Skip to content

Commit 5a82e00

Browse files
committed
Fix import path and reuse OperatorNewOrDelete
1 parent 28d79b2 commit 5a82e00

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

cpp/misra/src/rules/RULE-21-6-3/AdvancedMemoryManagementUsed.ql

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import cpp
1717
import codingstandards.cpp.misra
18-
import codingstandards.cpp.UnintializedMemoryAllocation
18+
import codingstandards.cpp.standardlibrary.Memory
1919
import codingstandards.cpp.allocations.CustomOperatorNewDelete
2020

2121
class AdvancedMemoryManagementFunction extends Function {
@@ -54,10 +54,7 @@ class UserDeclaredOperatorNewOrDelete extends FunctionDeclarationEntry {
5454
exists(this.getFile().getRelativePath()) and
5555
/* Not in a file called `new`, which is likely to be a stub of the standard library */
5656
not this.getFile().getBaseName() = "new" and
57-
(
58-
this.getName() in ["operator new", "operator new[]"] or
59-
this.getName() in ["operator delete", "operator delete[]"]
60-
)
57+
this.getFunction() instanceof OperatorNewOrDelete
6158
}
6259
}
6360

0 commit comments

Comments
 (0)