Browse Source

fix remaining coverity warnings

Julius Pfrommer 10 years ago
parent
commit
ae975ec861
2 changed files with 7 additions and 4 deletions
  1. 6 3
      src/server/ua_services_attribute.c
  2. 1 1
      src/server/ua_services_view.c

+ 6 - 3
src/server/ua_services_attribute.c

@@ -348,7 +348,6 @@ static UA_StatusCode writeValue(UA_Server *server, UA_WriteValue *writeValue) {
             break;
 
         case UA_ATTRIBUTEID_ISABSTRACT:
-            /* if(writeValue->value.encodingMask == UA_DATAVALUE_ENCODINGMASK_VARIANT){} */
             retval = UA_STATUSCODE_BADWRITENOTSUPPORTED;
             break;
 
@@ -373,9 +372,13 @@ static UA_StatusCode writeValue(UA_Server *server, UA_WriteValue *writeValue) {
             break;
 
         case UA_ATTRIBUTEID_VALUE:
-            if(writeValue->value.encodingMask == UA_DATAVALUE_ENCODINGMASK_VARIANT) {
-                retval |= UA_Variant_copy(&writeValue->value.value, &((UA_VariableNode *)newNode)->value); // todo: zero-copy
+            if(newNode->nodeClass != (UA_NODECLASS_VARIABLE | UA_NODECLASS_VARIABLETYPE)) {
+                retval = UA_STATUSCODE_BADWRITENOTSUPPORTED;
+                break;
             }
+
+            if(writeValue->value.encodingMask == UA_DATAVALUE_ENCODINGMASK_VARIANT)
+                retval |= UA_Variant_copy(&writeValue->value.value, &((UA_VariableNode *)newNode)->value); // todo: zero-copy
             break;
 
         case UA_ATTRIBUTEID_DATATYPE:

+ 1 - 1
src/server/ua_services_view.c

@@ -167,7 +167,7 @@ static void getBrowseResult(UA_NodeStore *ns, const UA_BrowseDescription *browse
     const UA_Node *parentNode = UA_NodeStore_get(ns, &browseDescription->nodeId);
     if(!parentNode) {
         browseResult->statusCode = UA_STATUSCODE_BADNODEIDUNKNOWN;
-        if(!returnAll && browseDescription->includeSubtypes)
+        if(!returnAll)
             UA_Array_delete(relevantReferenceTypes, relevantReferenceTypesSize, &UA_TYPES[UA_NODEID]);
         return;
     }