Skip to content

Commit 8fdc4b0

Browse files
committed
C++: Ensure that no call side effect is an allocation side effect
1 parent fa7dc32 commit 8fdc4b0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,11 @@ newtype TTranslatedElement =
443443
TTranslatedConditionDecl(ConditionDeclExpr expr) { not ignoreExpr(expr) } or
444444
// The side effects of a `Call`
445445
TTranslatedCallSideEffects(Call expr) {
446-
exists(TTranslatedArgumentSideEffect(expr, _, _, _)) or
447-
expr instanceof ConstructorCall
446+
not expr instanceof AllocationExpr and
447+
(
448+
exists(TTranslatedArgumentSideEffect(expr, _, _, _)) or
449+
expr instanceof ConstructorCall
450+
)
448451
} or
449452
// The side effects of an allocation, i.e. `new`, `new[]` or `malloc`
450453
TTranslatedAllocationSideEffects(AllocationExpr expr) or

0 commit comments

Comments
 (0)