diff options
Diffstat (limited to 'engines/scumm/resource.cpp')
-rw-r--r-- | engines/scumm/resource.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 0448f60593..10301da3e3 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -822,11 +822,12 @@ byte *ResourceManager::createResource(ResType type, ResId idx, uint32 size) { expireResources(size); - byte *ptr = (byte *)calloc(size + SAFETY_AREA, 1); + byte *ptr = new byte[size + SAFETY_AREA]; if (ptr == NULL) { error("createResource(%s,%d): Out of memory while allocating %d", nameOfResType(type), idx, size); } + memset(ptr, 0, size + SAFETY_AREA); _allocatedSize += size; _types[type][idx]._address = ptr; @@ -845,12 +846,12 @@ ResourceManager::Resource::Resource() { } ResourceManager::Resource::~Resource() { - delete _address; + delete[] _address; _address = 0; } void ResourceManager::Resource::nuke() { - delete _address; + delete[] _address; _address = 0; _size = 0; _flags = 0; |