From d035c2c624d5fd2d27eed811d219cfd81e9063ef Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 14 Jan 2012 14:15:03 +0100 Subject: 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 --- src/utils/zlib.cpp | 5 ++--- 1 file 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()); -- cgit v1.2.3-70-g09d2