aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-30 15:24:35 -0400
committerJack Lloyd <[email protected]>2017-09-30 15:24:35 -0400
commitdd860ab0c897ee6f3af8a549910e7ae0e3c4772c (patch)
treeeb4b859bfb8a70adb2473780403ab216cc10d0c2
parent584d04af150847984b44c29c75458199932af1bc (diff)
Guard against self-assignment
Found with Sonar
-rw-r--r--src/lib/filters/secqueue.cpp3
-rw-r--r--src/lib/x509/x509_ext.cpp3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/filters/secqueue.cpp b/src/lib/filters/secqueue.cpp
index feaa26b4c..4b1a263a8 100644
--- a/src/lib/filters/secqueue.cpp
+++ b/src/lib/filters/secqueue.cpp
@@ -103,6 +103,9 @@ void SecureQueue::destroy()
*/
SecureQueue& SecureQueue::operator=(const SecureQueue& input)
{
+ if(this == &input)
+ return *this;
+
destroy();
m_bytes_read = input.get_bytes_read();
m_head = m_tail = new SecureQueueNode;
diff --git a/src/lib/x509/x509_ext.cpp b/src/lib/x509/x509_ext.cpp
index d71af82b7..3141d3c44 100644
--- a/src/lib/x509/x509_ext.cpp
+++ b/src/lib/x509/x509_ext.cpp
@@ -57,6 +57,9 @@ Extensions::Extensions(const Extensions& extensions) : ASN1_Object()
*/
Extensions& Extensions::operator=(const Extensions& other)
{
+ if(this == &other)
+ return *this;
+
m_extensions.clear();
for(size_t i = 0; i != other.m_extensions.size(); ++i)