1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-19 21:10:12 +02:00

Fixes for issues detected by valgrind

This commit is contained in:
Ivan Savenko 2025-02-06 19:22:04 +00:00
parent fff5ac5945
commit 4e6560c4c9
4 changed files with 19 additions and 2 deletions

View File

@ -25,6 +25,11 @@ CanvasImage::CanvasImage(const Point & size, CanvasScalingPolicy scalingPolicy)
{
}
CanvasImage::~CanvasImage()
{
SDL_FreeSurface(surface);
}
void CanvasImage::draw(SDL_Surface * where, const Point & pos, const Rect * src, int scalingFactor) const
{
if(src)

View File

@ -16,6 +16,7 @@ class CanvasImage : public IImage
{
public:
CanvasImage(const Point & size, CanvasScalingPolicy scalingPolicy);
~CanvasImage();
Canvas getCanvas();

View File

@ -188,6 +188,7 @@ std::shared_ptr<Bonus> CBonusSystemNode::getUpdatedBonus(const std::shared_ptr<B
CBonusSystemNode::CBonusSystemNode(bool isHypotetic):
nodeType(UNKNOWN),
cachedLast(0),
nodeChanged(0),
isHypotheticNode(isHypotetic)
{
}
@ -195,6 +196,7 @@ CBonusSystemNode::CBonusSystemNode(bool isHypotetic):
CBonusSystemNode::CBonusSystemNode(ENodeTypes NodeType):
nodeType(NodeType),
cachedLast(0),
nodeChanged(0),
isHypotheticNode(false)
{
}

View File

@ -117,8 +117,17 @@ void CMapHeader::setupEvents()
defeatMessage.appendTextID("core.lcdesc.0");
}
CMapHeader::CMapHeader() : version(EMapFormat::VCMI), height(72), width(72),
twoLevel(true), difficulty(EMapDifficulty::NORMAL), levelLimit(0), howManyTeams(0), areAnyPlayers(false)
CMapHeader::CMapHeader()
: version(EMapFormat::VCMI)
, height(72)
, width(72)
, twoLevel(true)
, difficulty(EMapDifficulty::NORMAL)
, levelLimit(0)
, howManyTeams(0)
, areAnyPlayers(false)
, victoryIconIndex(0)
, defeatIconIndex(0)
{
setupEvents();
allowedHeroes = VLC->heroh->getDefaultAllowed();