From: garima-g Date: Thu, 5 Nov 2015 05:39:20 +0000 (+0530) Subject: Add self-assignment check in operator= X-Git-Tag: v1.10~2^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fad0b28a52685b761212ee2a7ee24c2538e3d4e;p=taglib Add self-assignment check in operator= Method 'operator=' should check its argument with 'this' pointer. --- diff --git a/taglib/ape/apeitem.cpp b/taglib/ape/apeitem.cpp index 3490173a..49c3a665 100644 --- a/taglib/ape/apeitem.cpp +++ b/taglib/ape/apeitem.cpp @@ -86,8 +86,10 @@ APE::Item::~Item() Item &APE::Item::operator=(const Item &item) { - delete d; - d = new ItemPrivate(*item.d); + if(&item != this) { + delete d; + d = new ItemPrivate(*item.d); + } return *this; }