summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-14 14:15:03 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-01-15 00:23:19 +0100
commitd035c2c624d5fd2d27eed811d219cfd81e9063ef (patch)
treeb03881527c28dddbcb9d529cdb6f08820e1bcf0c
parent3567d27ac0a472c90644ea643b48f7e85c767118 (diff)
downloadmana-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.gz
mana-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.bz2
mana-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.xz
mana-d035c2c624d5fd2d27eed811d219cfd81e9063ef.zip
Removed a strange if check on an uninitialized variable
The 'inflated' pointer wasn't initialized, but included in the if check for some reason (caught by valgrind). This would have caused support for .gz compressed maps to break sometimes, but since we don't use such maps anymore, maybe support for it should actually be dropped. Reviewed-by: Yohann Ferreira
-rw-r--r--src/utils/zlib.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/utils/zlib.cpp b/src/utils/zlib.cpp
index 8e2a1795..a6d47b47 100644
--- a/src/utils/zlib.cpp
+++ b/src/utils/zlib.cpp
@@ -152,15 +152,14 @@ void *loadCompressedFile(const std::string &filename, int &filesize)
unsigned char *inflated;
unsigned int inflatedSize;
- if (inflated && filename.find(".gz", filename.length() - 3)
- != std::string::npos)
+ if (filename.find(".gz", filename.length() - 3) != std::string::npos)
{
// Inflate the gzipped map data
inflatedSize =
inflateMemory((unsigned char*) buffer, filesize, inflated);
free(buffer);
- if (inflated == NULL)
+ if (!inflated)
{
logger->log("Could not decompress file: %s",
filename.c_str());