1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Arrays allocated with new[] must be deleted with delete[]

This commit is contained in:
Michał W. Urbańczyk 2007-12-23 16:46:33 +00:00
parent 6c2cf4ba29
commit 06a081c924
5 changed files with 11 additions and 11 deletions

View File

@ -1142,7 +1142,7 @@ void CResDataBar::draw()
printAt(processStr(datetext,temp),txtpos[7].first,txtpos[7].second,GEOR13,zwykly);
temp.clear();
//updateRect(&pos,ekran);
delete buf;
delete[] buf;
}
CInfoBar::CInfoBar()
{

View File

@ -1142,7 +1142,7 @@ SDL_Surface * CPlayerInterface::drawPrimarySkill(const CGHeroInstance *curh, SDL
itoa(curh->primSkills[i],buf,10);
printAtMiddle(buf,84+28*i,68,GEOR13,zwykly,ret);
}
delete buf;
delete[] buf;
return ret;
}
SDL_Surface * CPlayerInterface::drawHeroInfoWin(const CGHeroInstance * curh)
@ -1162,7 +1162,7 @@ SDL_Surface * CPlayerInterface::drawHeroInfoWin(const CGHeroInstance * curh)
blitAt(curh->type->portraitLarge,11,12,ret);
itoa(curh->mana,buf,10);
printAtMiddle(buf,166,109,GEORM,zwykly,ret); //mana points
delete buf;
delete[] buf;
blitAt(morale22->ourImages[curh->getCurrentMorale()+3].bitmap,14,84,ret);
blitAt(luck22->ourImages[curh->getCurrentLuck()+3].bitmap,14,101,ret);
//SDL_SaveBMP(ret,"inf1.bmp");

Binary file not shown.

View File

@ -411,7 +411,7 @@ CDefHandler * CLodHandler::giveDef(std::string defName)
nh->alphaTransformed = false;
ret = nh;
}
delete outp;
delete[] outp;
return ret;
}
CDefEssential * CLodHandler::giveDefEss(std::string defName)
@ -473,7 +473,7 @@ std::vector<CDefHandler *> CLodHandler::extractManyFiles(std::vector<std::string
nh->alphaTransformed = false;
ret[curDef] = nh;
}
delete outp;
delete[] outp;
}
//std::cout<<'\r'<<"Reading defs: 100% "<<std::endl;
for(int hh=0; hh<found.size(); ++hh)
@ -697,7 +697,7 @@ void CLodHandler::extract(std::string FName)
std::cout<<"LOD Extraction error"<<" "<<decRes<<" while extracting to "<<bufff<<std::endl;
}
}
delete outp;
delete[] outp;
}
FLOD.close();
}
@ -748,7 +748,7 @@ void CLodHandler::extractFile(std::string FName, std::string name)
std::cout<<"LOD Extraction error"<<" "<<decRes<<" while extracting to "<<bufff<<std::endl;
}
}
delete outp;
delete[] outp;
}
FLOD.close();
}
@ -834,7 +834,7 @@ std::string CLodHandler::getTextFile(std::string name)
outp = new unsigned char[entries[i].realSize];
FLOD.read((char*)outp, entries[i].realSize);
std::string ret = std::string((char*)outp);
delete outp;
delete[] outp;
return ret;
}
else //we will decompressing file
@ -847,8 +847,8 @@ std::string CLodHandler::getTextFile(std::string name)
std::string ret;
for (int itr=0;itr<entries[i].realSize;itr++)
ret+= *((char*)decomp+itr);
delete outp;
delete decomp;
delete[] outp;
delete[] decomp;
return ret;
}
}

View File

@ -47,7 +47,7 @@ public:
void convert();
SDL_Surface * getSurface();
CPCXConv(){pcx=bmp=NULL;pcxs=bmps=0;};
~CPCXConv(){if (pcxs) delete pcx; if(bmps) delete bmp;}
~CPCXConv(){if (pcxs) delete[] pcx; if(bmps) delete[] bmp;}
};
class CLodHandler
{