(svn r17610) [0.7] -Fix [FS#3227] (r17302): reloading an AI caused reading and later freeing of already freed memory

This commit is contained in:
rubidium 2009-09-22 12:31:45 +00:00
parent 57992d5eac
commit 88f87bc4ac
1 changed files with 8 additions and 1 deletions

View File

@ -59,7 +59,14 @@ Company::~Company()
if (CleaningPool()) return;
DeleteCompanyWindows(this->index);
this->name_1 = 0;
/* Zero the memory of the company; we might 'reuse' it later on.
* This is more a hack than a proper fix, but... it's already
* fixed in trunk by the new pool system and this is the only
* troublesome case in 0.7, so we'll leave it at this fix. */
CompanyID id = this->index;
memset(this, 0, sizeof(*this));
this->index = id;
}
/**