From b217cc640c6afeadab23e30dbb588245a4cbfde3 Mon Sep 17 00:00:00 2001 From: piotr-kaminski-intel <32583365+piotr-kaminski-intel@users.noreply.github.com> Date: Sat, 7 Oct 2017 00:50:55 +0200 Subject: [PATCH] Removing Klocwork issues from schema.h Removing Klocwork static code analysis critical issues: line 358: 'this->notValidatorIndex_' might not be initialized in this constructor. line :412 Pointer 'schemaDocument' checked for NULL at line 412 may be passed to function and may be dereferenced there by passing argument this to function 'CreateSchema' at line 419. Also there are 7 similar errors on lines 467 479 511 523 533 538 549. --- include/rapidjson/schema.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/rapidjson/schema.h b/include/rapidjson/schema.h index abcf1a102..2c5def19c 100644 --- a/include/rapidjson/schema.h +++ b/include/rapidjson/schema.h @@ -355,6 +355,7 @@ class Schema { not_(), type_((1 << kTotalSchemaType) - 1), // typeless validatorCount_(), + notValidatorIndex_(), properties_(), additionalPropertiesSchema_(), patternProperties_(), @@ -409,11 +410,9 @@ class Schema { } } - if (schemaDocument) { - AssignIfExist(allOf_, *schemaDocument, p, value, GetAllOfString(), document); - AssignIfExist(anyOf_, *schemaDocument, p, value, GetAnyOfString(), document); - AssignIfExist(oneOf_, *schemaDocument, p, value, GetOneOfString(), document); - } + AssignIfExist(allOf_, *schemaDocument, p, value, GetAllOfString(), document); + AssignIfExist(anyOf_, *schemaDocument, p, value, GetAnyOfString(), document); + AssignIfExist(oneOf_, *schemaDocument, p, value, GetOneOfString(), document); if (const ValueType* v = GetMember(value, GetNotString())) { schemaDocument->CreateSchema(¬_, p.Append(GetNotString(), allocator_), *v, document);