Skip to content

Commit

Permalink
fixed: memleak in AddonVersion operator=
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Marshall committed Jun 16, 2011
1 parent fe17261 commit 735635f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions xbmc/addons/AddonVersion.h
Expand Up @@ -30,7 +30,7 @@ namespace ADDON
class AddonVersion : public boost::totally_ordered<AddonVersion> {
public:
AddonVersion() : mEpoch(0), mUpstream(NULL), mRevision(NULL) {}
AddonVersion(const AddonVersion& other) { *this = other; }
AddonVersion(const AddonVersion& other) : mUpstream(NULL), mRevision(NULL) { *this = other; }
explicit AddonVersion(const CStdString& version);
~AddonVersion();

Expand Down Expand Up @@ -72,10 +72,12 @@ namespace ADDON

inline AddonVersion& AddonVersion::operator=(const AddonVersion& other)
{
free(mUpstream);
free(mRevision);
mEpoch = other.Epoch();
mUpstream = strdup(other.Upstream());
mRevision = strdup(other.Revision());
m_originalVersion = other.c_str();
m_originalVersion = other.m_originalVersion;
return *this;
}
}

0 comments on commit 735635f

Please sign in to comment.