Permalink
Browse files

fixed: memleak in AddonVersion operator=

  • Loading branch information...
1 parent fe17261 commit 735635fad711fa76c03378978448c96c8399b4fc Jonathan Marshall committed Jun 16, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 xbmc/addons/AddonVersion.h
@@ -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();
@@ -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.