Skip to content

Commit 3b5512c

Browse files
committed
astutils.cpp: avoid potential NULL dereference in isAliasOf()
1 parent 90c3d46 commit 3b5512c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/astutils.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,9 +1064,11 @@ bool isAliasOf(const Token *tok, nonneg int varid, bool* inconclusive)
10641064

10651065
bool isAliasOf(const Token* tok, const Token* expr, int* indirect)
10661066
{
1067-
const Token* r = nullptr;
10681067
if (indirect)
10691068
*indirect = 1;
1069+
if (!tok)
1070+
return false;
1071+
const Token* r = nullptr;
10701072
for (const ReferenceToken& ref : tok->refs()) {
10711073
const bool pointer = astIsPointer(ref.token);
10721074
r = findAstNode(expr, [&](const Token* childTok) {

0 commit comments

Comments
 (0)