diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-14 14:15:03 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-15 00:23:19 +0100 |
commit | d035c2c624d5fd2d27eed811d219cfd81e9063ef (patch) | |
tree | b03881527c28dddbcb9d529cdb6f08820e1bcf0c /src/utils/zlib.cpp | |
parent | 3567d27ac0a472c90644ea643b48f7e85c767118 (diff) | |
download | mana-client-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.gz mana-client-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.bz2 mana-client-d035c2c624d5fd2d27eed811d219cfd81e9063ef.tar.xz mana-client-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
Diffstat (limited to 'src/utils/zlib.cpp')
-rw-r--r-- | src/utils/zlib.cpp | 5 |
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()); |