1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-13 13:18:43 +02:00

Less leaks.

This commit is contained in:
Michał W. Urbańczyk 2008-01-21 18:46:07 +00:00
parent 449e7b6773
commit 10e4e2937f
3 changed files with 9 additions and 2 deletions

View File

@ -115,6 +115,12 @@ public:
CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate) CCastleInterface::CCastleInterface(const CGTownInstance * Town, bool Activate)
{ {
int t = 600;
while(t--)
{
CDefHandler* defik = CGI->spriteh->giveDef("ITMTL.DEF");
delete defik;
}
count=0; count=0;
town = Town; town = Town;
townInt = CGI->bitmaph->loadBitmap("TOWNSCRN.bmp"); townInt = CGI->bitmaph->loadBitmap("TOWNSCRN.bmp");

Binary file not shown.

View File

@ -386,7 +386,7 @@ CDefHandler * CLodHandler::giveDef(std::string defName)
{ {
outp = new unsigned char[ourEntry->realSize]; outp = new unsigned char[ourEntry->realSize];
fread((char*)outp, 1, ourEntry->realSize, FLOD); fread((char*)outp, 1, ourEntry->realSize, FLOD);
CDefHandler * nh = new CDefHandler; CDefHandler * nh = new CDefHandler();
nh->openFromMemory(outp, ourEntry->realSize, std::string((char*)ourEntry->name)); nh->openFromMemory(outp, ourEntry->realSize, std::string((char*)ourEntry->name));
nh->alphaTransformed = false; nh->alphaTransformed = false;
ret = nh; ret = nh;
@ -398,10 +398,11 @@ CDefHandler * CLodHandler::giveDef(std::string defName)
fseek(FLOD, 0, 0); fseek(FLOD, 0, 0);
unsigned char * decomp = NULL; unsigned char * decomp = NULL;
int decRes = infs2(outp, ourEntry->size, ourEntry->realSize, decomp); int decRes = infs2(outp, ourEntry->size, ourEntry->realSize, decomp);
CDefHandler * nh = new CDefHandler; CDefHandler * nh = new CDefHandler();
nh->openFromMemory(decomp, ourEntry->realSize, std::string((char*)ourEntry->name)); nh->openFromMemory(decomp, ourEntry->realSize, std::string((char*)ourEntry->name));
nh->alphaTransformed = false; nh->alphaTransformed = false;
ret = nh; ret = nh;
delete[] decomp;
} }
delete[] outp; delete[] outp;
return ret; return ret;