aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-05-24 03:47:07 +0200
committerdec05eba <dec05eba@protonmail.com>2018-05-24 03:47:10 +0200
commitaab52eb9561966977dc158abdc99bb599ea1e989 (patch)
treeaf94bd635297235aa30b8c3952fcd2af2c3a6059
parent81943b72a9a8de72da9dbdd6fa6337aae4d93ccf (diff)
Fix issues reported by compiler sanitizer
m---------depends/odhtdb0
-rw-r--r--src/Cache.cpp10
-rw-r--r--src/main.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/depends/odhtdb b/depends/odhtdb
-Subproject 27699207f857e06ac23707b55325565a2790e87
+Subproject 0ce0eaf93dea198a6b0f812c724be9bad74270b
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 9039bd6..ae07f9d 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -103,7 +103,7 @@ namespace dchat
fprintf(stderr, "Failed to read binds from file, reason: %s\n", e.what());
}
- delete fileContent.data;
+ delete[] fileContent.data;
}
void Cache::replaceBindsInFile(const unordered_map<string, string> &binds)
@@ -311,15 +311,15 @@ namespace dchat
checkContentAccessTimeThread.join();
}
- static void replaceFileIgnoreError(const boost::filesystem::path &path)
+ static void createFileIgnoreError(const boost::filesystem::path &path)
{
try
{
- fileReplace(path, StringView());
+ fileReplace(path, StringView("", 0));
}
catch(FileException &e)
{
- fprintf(stderr, "Failed to replace file: %s, reason: %s\n", path.string().c_str(), e.what());
+ fprintf(stderr, "Failed to create empty file: %s, reason: %s\n", path.string().c_str(), e.what());
}
}
@@ -363,7 +363,7 @@ namespace dchat
return contentByUrlResult;
}
- replaceFileIgnoreError(downloadingFilepath);
+ createFileIgnoreError(downloadingFilepath);
ContentByUrlResult result((sf::Texture*)nullptr, ContentByUrlResult::Type::DOWNLOADING);
contentUrlCache[url] = result;
diff --git a/src/main.cpp b/src/main.cpp
index 8b8bddf..f83339f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -947,7 +947,7 @@ int main(int argc, char **argv)
for(Channel *channel : channels)
{
- channel->update();
+ delete channel;
}
// We need to wait until our `ping` packet for disconnecting is sent to all channels