(svn r20089) -Fix [FS#3932]: Access of already freed memory, esp. due to hidden destructor call from Swap().

This commit is contained in:
frosch
2010-07-08 18:38:38 +00:00
parent 02e4371ecb
commit 4ce5c6d93d
3 changed files with 21 additions and 6 deletions

View File

@@ -27,6 +27,21 @@ ContentInfo::~ContentInfo()
free(this->tags);
}
/**
* Copy data from other #ContentInfo and take ownership of allocated stuff.
* @param other Source to copy from. #dependencies and #tags will be NULLed.
*/
void ContentInfo::TransferFrom(ContentInfo *other)
{
if (other != this) {
free(this->dependencies);
free(this->tags);
memcpy(this, other, sizeof(ContentInfo));
other->dependencies = NULL;
other->tags = NULL;
}
}
size_t ContentInfo::Size() const
{
size_t len = 0;