mirror of https://github.com/OpenTTD/OpenTTD.git
(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:
parent
57992d5eac
commit
88f87bc4ac
|
@ -59,7 +59,14 @@ Company::~Company()
|
||||||
if (CleaningPool()) return;
|
if (CleaningPool()) return;
|
||||||
|
|
||||||
DeleteCompanyWindows(this->index);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue