From 6d97cdf25db274a81e9d9edc417b51cf44152733 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 2 Jun 2011 18:41:23 +0300 Subject: Fix some memory leaks and missing initialisations. --- src/resources/mapreader.cpp | 2 +- src/resources/resourcemanager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/resources') diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index c5e52ae7c..fb0298457 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -86,7 +86,7 @@ int inflateMemory(unsigned char *in, unsigned int inLength, int ret; z_stream strm; - out = static_cast(malloc(bufferSize)); + out = static_cast(calloc(bufferSize, 1)); strm.zalloc = Z_NULL; strm.zfree = Z_NULL; diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index a86edbb6f..aea598935 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -584,7 +584,7 @@ void *ResourceManager::loadFile(const std::string &fileName, int &fileSize) fileSize = static_cast(PHYSFS_fileLength(file)); // Allocate memory and load the file - void *buffer = malloc(fileSize); + void *buffer = calloc(fileSize, 1); PHYSFS_read(file, buffer, 1, fileSize); // Close the file and let the user deallocate the memory -- cgit v1.2.3-70-g09d2