Quellcode durchsuchen

allocatig the dimensions on the heap

Stasik0 vor 10 Jahren
Ursprung
Commit
9ecab2fcf6
1 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 4 2
      src/ua_application.c

+ 4 - 2
src/ua_application.c

@@ -472,8 +472,10 @@ void appMockup_init() {
 	UA_String_copycstring("http://opcfoundation.org/UA/",&((UA_String *)((namespaceArray->value).data))[0]);
 	UA_String_copycstring("http://localhost:16664/open62541/",&((UA_String *)(((namespaceArray)->value).data))[1]);
 	namespaceArray->arrayDimensionsSize = 1;
-	UA_UInt32 dimensions = 2;
-	namespaceArray->arrayDimensions = &dimensions;
+	UA_UInt32* dimensions = UA_NULL;
+	UA_alloc((void**)&dimensions, sizeof(UA_UInt32));
+	*dimensions = 2;
+	namespaceArray->arrayDimensions = dimensions;
 	namespaceArray->dataType = NS0NODEID(UA_STRING_NS0);
 	namespaceArray->valueRank = 1;
 	namespaceArray->minimumSamplingInterval = 1.0;