Explorar o código

bugfix array mem allocation

Leon Urbas %!s(int64=11) %!d(string=hai) anos
pai
achega
e7ce756e49
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/opcua_basictypes.c

+ 1 - 1
src/opcua_basictypes.c

@@ -91,7 +91,7 @@ UA_Int32 UA_Array_new(void **p,UA_Int32 noElements, UA_Int32 type) {
 	// calculate the addresses to prevent memory segmentation. This would however not call
 	// init for each member
 	for(i=0; i<noElements; i++) {
-		retval |= UA_[type].new(p[i]);
+		retval |= UA_[type].new((void**)(*p + i * sizeof(void*)));
 	}
 	return retval;
 }