mirror of https://github.com/OpenRCT2/OpenRCT2.git
Change mallocs to new[]
This commit is contained in:
parent
e13d6da81f
commit
7c3401603d
|
@ -55,7 +55,7 @@ namespace ObjectJsonHelpers
|
||||||
{
|
{
|
||||||
auto length = g1_calculate_data_size(&orig);
|
auto length = g1_calculate_data_size(&orig);
|
||||||
g1 = orig;
|
g1 = orig;
|
||||||
g1.offset = (uint8_t*)std::malloc(length);
|
g1.offset = new uint8_t[length];
|
||||||
std::memcpy(g1.offset, orig.offset, length);
|
std::memcpy(g1.offset, orig.offset, length);
|
||||||
g1.flags &= ~G1_FLAG_HAS_ZOOM_SPRITE;
|
g1.flags &= ~G1_FLAG_HAS_ZOOM_SPRITE;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ namespace ObjectJsonHelpers
|
||||||
{
|
{
|
||||||
auto length = g1_calculate_data_size(orig);
|
auto length = g1_calculate_data_size(orig);
|
||||||
g1 = *orig;
|
g1 = *orig;
|
||||||
g1.offset = (uint8_t*)std::malloc(length);
|
g1.offset = new uint8_t[length];
|
||||||
std::memcpy(g1.offset, orig->offset, length);
|
std::memcpy(g1.offset, orig->offset, length);
|
||||||
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
|
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ namespace ObjectJsonHelpers
|
||||||
|
|
||||||
~RequiredImage()
|
~RequiredImage()
|
||||||
{
|
{
|
||||||
std::free(g1.offset);
|
delete[] g1.offset;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue