summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-29 09:15:12 (GMT)
committerTobias Markmann <tm@ayena.de>2016-09-29 09:31:53 (GMT)
commitc966e43b2852e69da1ed3cac9e11c1b026d4f4a9 (patch)
tree006ee4058a289a59a6f7fa1604903fd11c2d6d4a /Swiften
parent871c8955ae39e3eeb76a1bb72bf574764f5c30c3 (diff)
downloadswift-c966e43b2852e69da1ed3cac9e11c1b026d4f4a9.zip
swift-c966e43b2852e69da1ed3cac9e11c1b026d4f4a9.tar.bz2
Fix potential resource leaks
IDGenerator was missing the virtual keyword on its method which is reimplemented by SimpleIDGenerator. Some other classes were missing destructors or virtual destructors. Test-Information: Builds on macOS 10.12 with Qt 5.5.1, all unit tests pass. Change-Id: I482bc249578d38a922256d1fa5241515ce45d0c0
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/IDGenerator.cpp3
-rw-r--r--Swiften/Base/IDGenerator.h5
-rw-r--r--Swiften/Base/SimpleIDGenerator.cpp3
-rw-r--r--Swiften/Base/SimpleIDGenerator.h6
-rw-r--r--Swiften/MUC/MUCRegistry.h4
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.cpp3
-rw-r--r--Swiften/Parser/PayloadParserFactoryCollection.h1
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp3
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.h2
9 files changed, 23 insertions, 7 deletions
diff --git a/Swiften/Base/IDGenerator.cpp b/Swiften/Base/IDGenerator.cpp
index 5aa471c..b59a39c 100644
--- a/Swiften/Base/IDGenerator.cpp
+++ b/Swiften/Base/IDGenerator.cpp
@@ -16,6 +16,9 @@ namespace Swift {
IDGenerator::IDGenerator() {
}
+IDGenerator::~IDGenerator() {
+}
+
std::string IDGenerator::generateID() {
static boost::uuids::random_generator generator;
return boost::lexical_cast<std::string>(generator());
diff --git a/Swiften/Base/IDGenerator.h b/Swiften/Base/IDGenerator.h
index d1b5964..6b53994 100644
--- a/Swiften/Base/IDGenerator.h
+++ b/Swiften/Base/IDGenerator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -14,7 +14,8 @@ namespace Swift {
class SWIFTEN_API IDGenerator {
public:
IDGenerator();
+ virtual ~IDGenerator();
- std::string generateID();
+ virtual std::string generateID();
};
}
diff --git a/Swiften/Base/SimpleIDGenerator.cpp b/Swiften/Base/SimpleIDGenerator.cpp
index 072dd39..e6d72b3 100644
--- a/Swiften/Base/SimpleIDGenerator.cpp
+++ b/Swiften/Base/SimpleIDGenerator.cpp
@@ -11,6 +11,9 @@ namespace Swift {
SimpleIDGenerator::SimpleIDGenerator() {
}
+SimpleIDGenerator::~SimpleIDGenerator() {
+}
+
std::string SimpleIDGenerator::generateID() {
bool carry = true;
size_t i = 0;
diff --git a/Swiften/Base/SimpleIDGenerator.h b/Swiften/Base/SimpleIDGenerator.h
index 49ba59e..ff645b1 100644
--- a/Swiften/Base/SimpleIDGenerator.h
+++ b/Swiften/Base/SimpleIDGenerator.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -10,6 +10,7 @@
#include <Swiften/Base/API.h>
#include <Swiften/Base/IDGenerator.h>
+#include <Swiften/Base/Override.h>
namespace Swift {
@@ -21,8 +22,9 @@ namespace Swift {
class SWIFTEN_API SimpleIDGenerator : public IDGenerator {
public:
SimpleIDGenerator();
+ ~SimpleIDGenerator();
- std::string generateID();
+ std::string generateID() SWIFTEN_OVERRIDE;
private:
std::string currentID;
diff --git a/Swiften/MUC/MUCRegistry.h b/Swiften/MUC/MUCRegistry.h
index 3f61c71..aa341e4 100644
--- a/Swiften/MUC/MUCRegistry.h
+++ b/Swiften/MUC/MUCRegistry.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -16,7 +16,7 @@ namespace Swift {
class SWIFTEN_API MUCRegistry {
public:
- ~MUCRegistry();
+ virtual ~MUCRegistry();
bool isMUC(const JID& j) const;
void addMUC(const JID& j);
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp
index 4426428..bca1e83 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.cpp
+++ b/Swiften/Parser/PayloadParserFactoryCollection.cpp
@@ -17,6 +17,9 @@ namespace Swift {
PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(nullptr) {
}
+PayloadParserFactoryCollection::~PayloadParserFactoryCollection() {
+}
+
void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) {
factories_.push_back(factory);
}
diff --git a/Swiften/Parser/PayloadParserFactoryCollection.h b/Swiften/Parser/PayloadParserFactoryCollection.h
index 06e334e..cc0db5a 100644
--- a/Swiften/Parser/PayloadParserFactoryCollection.h
+++ b/Swiften/Parser/PayloadParserFactoryCollection.h
@@ -17,6 +17,7 @@ namespace Swift {
class SWIFTEN_API PayloadParserFactoryCollection {
public:
PayloadParserFactoryCollection();
+ virtual ~PayloadParserFactoryCollection();
void addFactory(PayloadParserFactory* factory);
void removeFactory(PayloadParserFactory* factory);
diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp
index dd20364..114512e 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializerCollection.cpp
@@ -17,6 +17,9 @@ namespace Swift {
PayloadSerializerCollection::PayloadSerializerCollection() {
}
+PayloadSerializerCollection::~PayloadSerializerCollection() {
+}
+
void PayloadSerializerCollection::addSerializer(PayloadSerializer* serializer) {
serializers_.push_back(serializer);
}
diff --git a/Swiften/Serializer/PayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializerCollection.h
index a0fe2ea..53b3135 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.h
+++ b/Swiften/Serializer/PayloadSerializerCollection.h
@@ -15,10 +15,10 @@
namespace Swift {
class PayloadSerializer;
-
class SWIFTEN_API PayloadSerializerCollection {
public:
PayloadSerializerCollection();
+ virtual ~PayloadSerializerCollection();
void addSerializer(PayloadSerializer* factory);
void removeSerializer(PayloadSerializer* factory);