Browse Source

fix an issue in the write service

Julius Pfrommer 6 years ago
parent
commit
334e25a86d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/server/ua_services_attribute.c

+ 2 - 1
src/server/ua_services_attribute.c

@@ -783,12 +783,13 @@ writeArrayDimensionsAttribute(UA_Server *server, UA_Session *session,
 
 
     /* Ok, apply */
     /* Ok, apply */
     UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
     UA_UInt32 *oldArrayDimensions = node->arrayDimensions;
+    size_t oldArrayDimensionsSize = node->arrayDimensionsSize;
     retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
     retval = UA_Array_copy(arrayDimensions, arrayDimensionsSize,
                            (void**)&node->arrayDimensions,
                            (void**)&node->arrayDimensions,
                            &UA_TYPES[UA_TYPES_UINT32]);
                            &UA_TYPES[UA_TYPES_UINT32]);
     if(retval != UA_STATUSCODE_GOOD)
     if(retval != UA_STATUSCODE_GOOD)
         return retval;
         return retval;
-    UA_free(oldArrayDimensions);
+    UA_Array_delete(oldArrayDimensions, oldArrayDimensionsSize, &UA_TYPES[UA_TYPES_UINT32]);
     node->arrayDimensionsSize = arrayDimensionsSize;
     node->arrayDimensionsSize = arrayDimensionsSize;
     return UA_STATUSCODE_GOOD;
     return UA_STATUSCODE_GOOD;
 }
 }