aboutsummaryrefslogtreecommitdiffstats
path: root/taglib/asf
diff options
context:
space:
mode:
authorgarima-g <garima.g@samsung.com>2015-11-05 11:12:24 +0530
committergarima-g <garima.g@samsung.com>2015-11-05 11:12:24 +0530
commitccaf6502144ec787c0d8cd9fc16bbe903f25b37a (patch)
tree49000d8cbc2900aa45c5696ae9012d5293ee0c1c /taglib/asf
parent9fad0b28a52685b761212ee2a7ee24c2538e3d4e (diff)
Add self-assignment check in operator=
Method 'operator=' should check its argument with 'this' pointer.
Diffstat (limited to 'taglib/asf')
-rw-r--r--taglib/asf/asfattribute.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/taglib/asf/asfattribute.cpp b/taglib/asf/asfattribute.cpp
index 116bfe21..7a40bea3 100644
--- a/taglib/asf/asfattribute.cpp
+++ b/taglib/asf/asfattribute.cpp
@@ -72,10 +72,12 @@ ASF::Attribute::Attribute(const ASF::Attribute &other)
ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &other)
{
- if(d->deref())
- delete d;
- d = other.d;
- d->ref();
+ if(&other != this) {
+ if(d->deref())
+ delete d;
+ d = other.d;
+ d->ref();
+ }
return *this;
}