projects
/
taglib
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9fad0b2
)
Add self-assignment check in operator=
author
garima-g
<garima.g@samsung.com>
Thu, 5 Nov 2015 05:42:24 +0000
(11:12 +0530)
committer
garima-g
<garima.g@samsung.com>
Thu, 5 Nov 2015 05:42:24 +0000
(11:12 +0530)
Method 'operator=' should check its argument with 'this' pointer.
taglib/asf/asfattribute.cpp
patch
|
blob
|
history
diff --git
a/taglib/asf/asfattribute.cpp
b/taglib/asf/asfattribute.cpp
index 116bfe21d79e67620b22660b398e4cf74316e7d8..7a40bea3aa604c7b212e13420398732335318d1b 100644
(file)
--- 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;
}