C#: Fix byteCount in NativeMemory.Alloc

`NativeMemory.Alloc` takes the byte count as parameter, this is
calculated by multiplying the element size in bytes by the length
of the array.
This commit is contained in:
Raul Santos 2022-08-27 17:18:13 +02:00
parent 85ef0a1058
commit ebe008d41b
No known key found for this signature in database
GPG key ID: B532473AE3A803E4

View file

@ -831,7 +831,7 @@ namespace Godot.Bridge
} }
else else
{ {
interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc((nuint)length))!; interopProperties = ((godotsharp_property_info*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_info)))!;
} }
try try
@ -951,7 +951,7 @@ namespace Godot.Bridge
} }
else else
{ {
interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc((nuint)length))!; interopDefaultValues = ((godotsharp_property_def_val_pair*)NativeMemory.Alloc((nuint)length, (nuint)sizeof(godotsharp_property_def_val_pair)))!;
} }
try try