From 61195c7664c60ab08e44be218aa2b2d476335348 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 5 Aug 2015 23:49:52 +0300 Subject: Fix possible false positives in detecting pointers. --- src/analysis/reports.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/analysis/reports.cpp b/src/analysis/reports.cpp index be91c3a..ddc78bb 100644 --- a/src/analysis/reports.cpp +++ b/src/analysis/reports.cpp @@ -179,13 +179,21 @@ void reportParmDeclAttrNullPointer(Node *mainNode, { if (node == PARM_DECL) { - if (isIn(node->label, wi.needCheckNullVars)) + ParmDeclNode *parmDecl = static_cast(node); + if (parmDecl->declType == POINTER_TYPE && + isIn(node->label, wi.needCheckNullVars)) + { reportPossibleNullPointer(mainNode, node->label); + } } else if (node == VAR_DECL) { - if (isIn(node->label, wi.needCheckNullVars)) + VarDeclNode *varDecl = static_cast(node); + if (varDecl->varType == POINTER_TYPE && + isIn(node->label, wi.needCheckNullVars)) + { reportPossibleNullPointer(mainNode, node->label); + } } } else if (node == COMPONENT_REF) -- cgit v1.2.3-60-g2f50