mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
DRAGONS: Coverity Scan fixes. Memory leaks, uninitialised variables.
This commit is contained in:
parent
896d281ddc
commit
ea7ea9f075
@ -57,6 +57,7 @@ Actor *ActorManager::loadActor(uint32 resourceId, uint32 sequenceId, int16 x, in
|
||||
} else {
|
||||
//TODO run find by resource and remove from mem logic here. @0x800358c8
|
||||
debug("Unable to find free actor slot!!");
|
||||
delete resource;
|
||||
}
|
||||
resetDisplayOrder();
|
||||
return actor;
|
||||
@ -149,6 +150,7 @@ Actor::Actor(uint16 id) : _actorID(id) {
|
||||
|
||||
void Actor::init(ActorResource *resource, int16 x, int16 y, uint32 sequenceID) {
|
||||
debug(3, "actor %d Init", _actorID);
|
||||
delete _actorResource;
|
||||
_actorResource = resource;
|
||||
_x_pos = x;
|
||||
_y_pos = y;
|
||||
@ -209,6 +211,8 @@ void Actor::reset_maybe() {
|
||||
_flags = 0;
|
||||
//TODO actor_find_by_resourceId_and_remove_resource_from_mem_maybe(resourceID);
|
||||
freeFrame();
|
||||
delete _actorResource;
|
||||
_actorResource = NULL;
|
||||
}
|
||||
|
||||
uint32 calcDistance(int32 x1, int32 y1, int32 x2, int32 y2) {
|
||||
|
@ -186,4 +186,17 @@ byte *ActorResource::getPalette() {
|
||||
return _palette;
|
||||
}
|
||||
|
||||
ActorResource::ActorResource() : _id(0), _data(nullptr), _fileSize(0), _frames(nullptr),
|
||||
_framesCount(0),
|
||||
_sequenceTableOffset(0) {
|
||||
memset(_palette, 0, 512);
|
||||
}
|
||||
|
||||
ActorResource::~ActorResource() {
|
||||
if (_data) {
|
||||
free(_data);
|
||||
}
|
||||
delete _frames;
|
||||
}
|
||||
|
||||
} // End of namespace Dragons
|
||||
|
@ -67,6 +67,8 @@ private:
|
||||
//uint16 _sequenceCount;
|
||||
|
||||
public:
|
||||
ActorResource();
|
||||
~ActorResource();
|
||||
bool load(uint32 id, byte *dataStart, Common::SeekableReadStream &stream);
|
||||
Graphics::Surface *loadFrame(ActorFrame &frameNumber, byte *palette);
|
||||
ActorFrame *loadFrameHeader(uint16 frameOffset);
|
||||
|
@ -71,6 +71,14 @@ struct TileMap {
|
||||
uint32 size;
|
||||
byte *map;
|
||||
uint16 tileIndexOffset;
|
||||
|
||||
TileMap() {
|
||||
w = 0;
|
||||
h = 0;
|
||||
size = 0;
|
||||
map = nullptr;
|
||||
tileIndexOffset = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class Background {
|
||||
|
@ -64,6 +64,8 @@ void DragonINIResource::reset() {
|
||||
}
|
||||
|
||||
_flickerINI = &_dragonINI[0];
|
||||
|
||||
delete readStream;
|
||||
}
|
||||
|
||||
DragonINI *DragonINIResource::getRecord(uint16 index) {
|
||||
|
@ -47,6 +47,7 @@ DragonRMS::DragonRMS(BigfileArchive *bigfileArchive, DragonOBD *dragonOBD) : _dr
|
||||
_rmsObjects[i]._field16 = readStream->readSint32LE();
|
||||
_rmsObjects[i]._field1a = readStream->readSint16LE();
|
||||
}
|
||||
delete readStream;
|
||||
}
|
||||
|
||||
char *DragonRMS::getSceneName(uint32 sceneId) {
|
||||
|
@ -96,6 +96,8 @@ DragonsEngine::DragonsEngine(OSystem *syst, const ADGameDescription *desc) : Eng
|
||||
_debugMode = false;
|
||||
_isGamePaused = false;
|
||||
|
||||
_bit_flags_8006fbd8 = 0;
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ Inventory::Inventory(DragonsEngine *vm) : _vm(vm) {
|
||||
_screenPositionIndex = 0;
|
||||
_previousState = Closed;
|
||||
_bag = NULL;
|
||||
_actor = NULL;
|
||||
|
||||
_inventionBookPrevSceneUpdateFunc = NULL;
|
||||
_inventionBookPrevSceneId = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user