Change mallocs to new[]

This commit is contained in:
Ted John 2018-12-10 19:57:27 +00:00
parent e13d6da81f
commit 7c3401603d
1 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ namespace ObjectJsonHelpers
{
auto length = g1_calculate_data_size(&orig);
g1 = orig;
g1.offset = (uint8_t*)std::malloc(length);
g1.offset = new uint8_t[length];
std::memcpy(g1.offset, orig.offset, length);
g1.flags &= ~G1_FLAG_HAS_ZOOM_SPRITE;
}
@ -67,7 +67,7 @@ namespace ObjectJsonHelpers
{
auto length = g1_calculate_data_size(orig);
g1 = *orig;
g1.offset = (uint8_t*)std::malloc(length);
g1.offset = new uint8_t[length];
std::memcpy(g1.offset, orig->offset, length);
if ((g1.flags & G1_FLAG_HAS_ZOOM_SPRITE) && g1.zoomed_offset != 0)
{
@ -84,7 +84,7 @@ namespace ObjectJsonHelpers
~RequiredImage()
{
std::free(g1.offset);
delete[] g1.offset;
}
};