summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-08-14 09:51:37 +0200
committerGitHub <noreply@github.com>2016-08-14 09:51:37 +0200
commit0a58d1de583dafd8d81251f2f5ac23159726990b (patch)
tree68f7279d31a2147962db6b26cab6554ac262a198 /src/OSSupport
parentRevert "Added a BasicStyleCheck for virtual functions without override keyword." (diff)
parentIPLookup: Fixed a soft memory leak when looking up invalid IPs. (diff)
downloadcuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar.gz
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar.bz2
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar.lz
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar.xz
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.tar.zst
cuberite-0a58d1de583dafd8d81251f2f5ac23159726990b.zip
Diffstat (limited to 'src/OSSupport')
-rw-r--r--src/OSSupport/IPLookup.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/OSSupport/IPLookup.cpp b/src/OSSupport/IPLookup.cpp
index 8cdc5132d..2722d4722 100644
--- a/src/OSSupport/IPLookup.cpp
+++ b/src/OSSupport/IPLookup.cpp
@@ -103,7 +103,13 @@ bool cNetwork::IPToHostName(
{
auto res = std::make_shared<cIPLookup>(a_Callbacks);
cNetworkSingleton::Get().AddIPLookup(res);
- return res->Lookup(a_IP);
+ if (!res->Lookup(a_IP))
+ {
+ // Lookup failed early on, remove the object completely:
+ cNetworkSingleton::Get().RemoveIPLookup(res.get());
+ return false;
+ }
+ return true;
}