aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/keymapper/keymap.cpp14
-rw-r--r--backends/keymapper/keymapper.cpp2
-rw-r--r--backends/keymapper/remap-dialog.cpp6
-rw-r--r--backends/midi/timidity.cpp5
-rw-r--r--common/EventDispatcher.cpp3
-rw-r--r--common/EventRecorder.cpp8
-rw-r--r--engines/agos/agos.cpp3
-rw-r--r--engines/agos/detection.cpp2
-rw-r--r--engines/agos/saveload.cpp2
-rw-r--r--engines/cine/object.cpp2
-rw-r--r--engines/cruise/detection.cpp2
-rw-r--r--engines/cruise/saveload.cpp2
-rw-r--r--engines/groovie/detection.cpp5
-rw-r--r--engines/kyra/script_lol.cpp1
-rw-r--r--engines/lure/animseq.cpp3
-rw-r--r--engines/lure/disk.cpp2
-rw-r--r--engines/lure/fights.cpp5
-rw-r--r--engines/lure/hotspots.cpp2
-rw-r--r--engines/lure/intro.cpp9
-rw-r--r--engines/lure/menu.cpp2
-rw-r--r--engines/lure/res_struct.cpp2
-rw-r--r--engines/lure/room.cpp5
-rw-r--r--engines/lure/sound.cpp6
-rw-r--r--engines/m4/actor.cpp3
-rw-r--r--engines/m4/events.cpp3
-rw-r--r--engines/m4/globals.cpp2
-rw-r--r--engines/m4/gui.cpp3
-rw-r--r--engines/m4/m4_menus.cpp6
-rw-r--r--engines/m4/mads_anim.cpp9
-rw-r--r--engines/m4/mads_menus.cpp6
-rw-r--r--engines/m4/midi.cpp4
-rw-r--r--engines/m4/scene.cpp19
-rw-r--r--engines/m4/script.cpp10
-rw-r--r--engines/m4/woodscript.cpp2
-rw-r--r--engines/made/database.cpp6
-rw-r--r--engines/made/pmvplayer.cpp4
-rw-r--r--engines/made/resource.cpp6
-rw-r--r--engines/parallaction/gui.cpp2
-rw-r--r--engines/sci/gfx/gfx_resource.cpp6
-rw-r--r--engines/sci/gui/gui_animate.cpp12
-rw-r--r--engines/sci/gui/gui_text.cpp8
-rw-r--r--engines/sci/gui32/res_pal.cpp1
-rw-r--r--engines/sci/sfx/music.cpp3
-rw-r--r--engines/sci/sfx/softseq/adlib.cpp4
-rw-r--r--engines/scumm/file.cpp4
-rw-r--r--engines/scumm/he/resource_he.cpp12
-rw-r--r--engines/scumm/imuse/imuse_player.cpp3
-rw-r--r--engines/scumm/imuse/instrument.cpp3
-rw-r--r--engines/scumm/smush/smush_player.cpp8
-rw-r--r--engines/sky/control.cpp15
-rw-r--r--engines/sky/detection.cpp2
-rw-r--r--engines/sky/intro.cpp3
-rw-r--r--engines/sky/music/musicbase.cpp6
-rw-r--r--engines/sky/screen.cpp9
-rw-r--r--engines/sky/sound.cpp6
-rw-r--r--engines/sky/text.cpp9
-rw-r--r--engines/sword1/resman.cpp4
-rw-r--r--engines/sword1/screen.cpp13
-rw-r--r--sound/midiparser_smf.cpp3
-rw-r--r--sound/mods/infogrames.cpp9
-rw-r--r--sound/softsynth/mt32.cpp3
-rw-r--r--sound/softsynth/mt32/synth.cpp3
62 files changed, 117 insertions, 210 deletions
diff --git a/backends/keymapper/keymap.cpp b/backends/keymapper/keymap.cpp
index 1c0d8528f2..93581c622d 100644
--- a/backends/keymapper/keymap.cpp
+++ b/backends/keymapper/keymap.cpp
@@ -36,7 +36,7 @@ namespace Common {
Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDomain(0) {
List<Action*>::iterator it;
- for (it = _actions.begin(); it != _actions.end(); it++) {
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
const HardwareKey *hwKey = (*it)->getMappedKey();
if (hwKey) {
@@ -48,7 +48,7 @@ Keymap::Keymap(const Keymap& km) : _actions(km._actions), _keymap(), _configDoma
Keymap::~Keymap() {
List<Action*>::iterator it;
- for (it = _actions.begin(); it != _actions.end(); it++)
+ for (it = _actions.begin(); it != _actions.end(); ++it)
delete *it;
}
@@ -87,7 +87,7 @@ Action *Keymap::getAction(const char *id) {
Action *Keymap::findAction(const char *id) {
List<Action*>::iterator it;
- for (it = _actions.begin(); it != _actions.end(); it++) {
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
return *it;
}
@@ -97,7 +97,7 @@ Action *Keymap::findAction(const char *id) {
const Action *Keymap::findAction(const char *id) const {
List<Action*>::const_iterator it;
- for (it = _actions.begin(); it != _actions.end(); it++) {
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
if (strncmp((*it)->id, id, ACTION_ID_SIZE) == 0)
return *it;
}
@@ -127,7 +127,7 @@ void Keymap::loadMappings(const HardwareKeySet *hwKeys) {
ConfigManager::Domain::iterator it;
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
- for (it = _configDomain->begin(); it != _configDomain->end(); it++) {
+ for (it = _configDomain->begin(); it != _configDomain->end(); ++it) {
const String& key = it->_key;
if (!key.hasPrefix(prefix.c_str()))
@@ -164,7 +164,7 @@ void Keymap::saveMappings() {
List<Action*>::const_iterator it;
String prefix = KEYMAP_KEY_PREFIX + _name + "_";
- for (it = _actions.begin(); it != _actions.end(); it++) {
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
uint actIdLen = strlen((*it)->id);
actIdLen = (actIdLen > ACTION_ID_SIZE) ? ACTION_ID_SIZE : actIdLen;
@@ -186,7 +186,7 @@ bool Keymap::isComplete(const HardwareKeySet *hwKeys) {
bool allMapped = true;
uint numberMapped = 0;
- for (it = _actions.begin(); it != _actions.end(); it++) {
+ for (it = _actions.begin(); it != _actions.end(); ++it) {
if ((*it)->getMappedKey()) {
numberMapped++;
} else {
diff --git a/backends/keymapper/keymapper.cpp b/backends/keymapper/keymapper.cpp
index df1facf1c1..557900adc1 100644
--- a/backends/keymapper/keymapper.cpp
+++ b/backends/keymapper/keymapper.cpp
@@ -41,7 +41,7 @@ void Keymapper::Domain::addKeymap(Keymap *map) {
}
void Keymapper::Domain::deleteAllKeyMaps() {
- for (iterator it = begin(); it != end(); it++)
+ for (iterator it = begin(); it != end(); ++it)
delete it->_value;
clear();
diff --git a/backends/keymapper/remap-dialog.cpp b/backends/keymapper/remap-dialog.cpp
index 850f25c4a3..cd6ca1237a 100644
--- a/backends/keymapper/remap-dialog.cpp
+++ b/backends/keymapper/remap-dialog.cpp
@@ -94,7 +94,7 @@ void RemapDialog::open() {
if (_globalKeymaps) {
if (divider)
_kmPopUp->appendEntry("");
- for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); it++) {
+ for (it = _globalKeymaps->begin(); it != _globalKeymaps->end(); ++it) {
_kmPopUp->appendEntry(it->_value->getName() + " (Global)", idx);
_keymapTable[idx++] = it->_value;
}
@@ -104,7 +104,7 @@ void RemapDialog::open() {
if (_gameKeymaps) {
if (divider)
_kmPopUp->appendEntry("");
- for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); it++) {
+ for (it = _gameKeymaps->begin(); it != _gameKeymaps->end(); ++it) {
_kmPopUp->appendEntry(it->_value->getName() + " (Game)", idx);
_keymapTable[idx++] = it->_value;
}
@@ -317,7 +317,7 @@ void RemapDialog::loadKeymap() {
List<Action*>::iterator it;
- for (it = km->getActions().begin(); it != km->getActions().end(); it++) {
+ for (it = km->getActions().begin(); it != km->getActions().end(); ++it) {
ActionInfo info = {*it, false, (*it)->description};
_currentActions.push_back(info);
diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index 584518d736..36d437414f 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -320,13 +320,12 @@ int MidiDriver_TIMIDITY::connect_to_server(const char* hostname, unsigned short
char *MidiDriver_TIMIDITY::timidity_ctl_command(const char *fmt, ...) {
/* XXX: I don't like this static buffer!!! */
static char buff[BUFSIZ];
- int status, len;
va_list ap;
if (fmt != NULL) {
/* if argumends are present, write them to control connection */
va_start(ap, fmt);
- len = vsnprintf(buff, BUFSIZ-1, fmt, ap); /* leave one byte for \n */
+ int len = vsnprintf(buff, BUFSIZ-1, fmt, ap); /* leave one byte for \n */
va_end(ap);
/* add newline if needed */
@@ -345,7 +344,7 @@ char *MidiDriver_TIMIDITY::timidity_ctl_command(const char *fmt, ...) {
}
/* report errors from server */
- status = atoi(buff);
+ int status = atoi(buff);
if (400 <= status && status <= 499) { /* Error of data stream */
warning("TiMidity: error from server: %s", buff);
continue;
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index a77c527969..d295cb9f81 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -72,8 +72,7 @@ void EventDispatcher::dispatch() {
}
void EventDispatcher::registerMapper(EventMapper *mapper) {
- if (_mapper)
- delete _mapper;
+ delete _mapper;
_mapper = mapper;
}
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index aea17d8f89..47ab3da3d6 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -203,12 +203,8 @@ void EventRecorder::deinit() {
g_system->unlockMutex(_timeMutex);
g_system->unlockMutex(_recorderMutex);
- if (_playbackFile != NULL) {
- delete _playbackFile;
- }
- if (_playbackTimeFile != NULL) {
- delete _playbackTimeFile;
- }
+ delete _playbackFile;
+ delete _playbackTimeFile;
if (_recordFile != NULL) {
_recordFile->finalize();
diff --git a/engines/agos/agos.cpp b/engines/agos/agos.cpp
index 2ebc0e0206..ab2fe39d4e 100644
--- a/engines/agos/agos.cpp
+++ b/engines/agos/agos.cpp
@@ -894,8 +894,7 @@ AGOSEngine::~AGOSEngine() {
delete _gameFile;
_midi.close();
- if (_driver)
- delete _driver;
+ delete _driver;
AudioCD.stop();
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index d4eaa03ca9..9484e17d8e 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -194,7 +194,7 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const {
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
- for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Obtain the last 3 digits of the filename, since they correspond to the save slot
int slotNum = atoi(file->c_str() + file->size() - 3);
diff --git a/engines/agos/saveload.cpp b/engines/agos/saveload.cpp
index dfd11a4514..603ac7ea92 100644
--- a/engines/agos/saveload.cpp
+++ b/engines/agos/saveload.cpp
@@ -49,7 +49,7 @@ int AGOSEngine::countSaveGames() {
memset(marks, false, 256 * sizeof(bool)); //assume no savegames for this title
filenames = _saveFileMan->listSavefiles(prefix);
- for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++){
+ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file){
//Obtain the last 3 digits of the filename, since they correspond to the save slot
slot[0] = file->c_str()[file->size()-3];
slot[1] = file->c_str()[file->size()-2];
diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp
index 42139a37c3..7fde7ee1e6 100644
--- a/engines/cine/object.cpp
+++ b/engines/cine/object.cpp
@@ -40,7 +40,7 @@ Common::List<overlay> overlayList;
/*! \brief Resets all elements in the object table. */
void resetObjectTable() {
- for (Common::Array<ObjectStruct>::iterator it = objectTable.begin(); it != objectTable.end(); it++) {
+ for (Common::Array<ObjectStruct>::iterator it = objectTable.begin(); it != objectTable.end(); ++it) {
it->clear();
}
}
diff --git a/engines/cruise/detection.cpp b/engines/cruise/detection.cpp
index d6095092ac..5fc96ffff2 100644
--- a/engines/cruise/detection.cpp
+++ b/engines/cruise/detection.cpp
@@ -262,7 +262,7 @@ SaveStateList CruiseMetaEngine::listSaves(const char *target) const {
Cruise::CruiseSavegameHeader header;
Cruise::readSavegameHeader(in, header);
saveList.push_back(SaveStateDescriptor(slotNum, header.saveName));
- if (header.thumbnail) delete header.thumbnail;
+ delete header.thumbnail;
delete in;
}
}
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index a7351ff700..92cccc7026 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -828,7 +828,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
// Skip over the savegame header
CruiseSavegameHeader header;
readSavegameHeader(f, header);
- if (header.thumbnail) delete header.thumbnail;
+ delete header.thumbnail;
// Synchronise the remaining data of the savegame
Common::Serializer s(f, NULL);
diff --git a/engines/groovie/detection.cpp b/engines/groovie/detection.cpp
index 7f520dbc6a..c2776b1049 100644
--- a/engines/groovie/detection.cpp
+++ b/engines/groovie/detection.cpp
@@ -238,10 +238,7 @@ SaveStateDescriptor GroovieMetaEngine::querySaveMetaInfos(const char *target, in
SaveStateDescriptor desc;
Common::InSaveFile *savefile = SaveLoad::openForLoading(target, slot, &desc);
- if (savefile) {
- // Loaded correctly
- delete savefile;
- }
+ delete savefile;
return desc;
}
diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp
index de431fadf0..cf4f9ecdaf 100644
--- a/engines/kyra/script_lol.cpp
+++ b/engines/kyra/script_lol.cpp
@@ -2202,6 +2202,7 @@ int LoLEngine::olol_restoreMagicShroud(EMCState *script) {
WSAMovie_v2 *mov = new WSAMovie_v2(this);
mov->open("DARKLITE.WSA", 2, 0);
if (!mov->opened()) {
+ delete mov;
warning("LoLEngine::olol_restoreMagicShroud: Could not open file: \"DARKLITE.WSA\"");
return 1;
}
diff --git a/engines/lure/animseq.cpp b/engines/lure/animseq.cpp
index f53b532815..9c18cb33aa 100644
--- a/engines/lure/animseq.cpp
+++ b/engines/lure/animseq.cpp
@@ -213,8 +213,7 @@ AnimationSequence::AnimationSequence(uint16 screenId, Palette &palette, bool fa
}
AnimationSequence::~AnimationSequence() {
- if (_lineRefs != NULL)
- delete _lineRefs;
+ delete _lineRefs;
delete _decodedData;
// Renable GMM saving/loading now that the animation is done
diff --git a/engines/lure/disk.cpp b/engines/lure/disk.cpp
index b04cbdac27..4c6ebc8962 100644
--- a/engines/lure/disk.cpp
+++ b/engines/lure/disk.cpp
@@ -49,7 +49,7 @@ Disk::Disk() {
}
Disk::~Disk() {
- if (_fileHandle) delete _fileHandle;
+ delete _fileHandle;
int_disk = NULL;
}
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 930d46640e..c5c49f1744 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -49,9 +49,8 @@ FightsManager::FightsManager() : _rnd(LureEngine::getReference().rnd()) {
}
FightsManager::~FightsManager() {
- if (_fightData != NULL)
- // Release the fight data
- delete _fightData;
+ // Release the fight data
+ delete _fightData;
}
FightsManager &FightsManager::getReference() {
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index 9fa55ef33d..0837f970f2 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -199,7 +199,7 @@ Hotspot::Hotspot(): _pathFinder(NULL) {
}
Hotspot::~Hotspot() {
- if (_frames) delete _frames;
+ delete _frames;
}
void Hotspot::setAnimation(uint16 newAnimId) {
diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp
index 5afc2d7aaf..e054408a49 100644
--- a/engines/lure/intro.cpp
+++ b/engines/lure/intro.cpp
@@ -131,8 +131,13 @@ bool Introduction::show() {
anim = new AnimationSequence(curr_anim->resourceId,
isEGA ? EgaPalette : coll.getPalette(curr_anim->paletteIndex), fadeIn,
(curr_anim->resourceId == 0x44) ? 4 : 7);
- if (curr_anim->initialPause != 0)
- if (interruptableDelay(curr_anim->initialPause * 1000 / 50)) return true;
+
+ if (curr_anim->initialPause != 0) {
+ if (interruptableDelay(curr_anim->initialPause * 1000 / 50)) {
+ delete anim;
+ return true;
+ }
+ }
result = false;
switch (anim->show()) {
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 4d91284364..746a4a8611 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -175,7 +175,7 @@ uint8 Menu::execute() {
system.delayMillis(10);
}
- if (_surfaceMenu) delete _surfaceMenu;
+ delete _surfaceMenu;
// Deselect the currently selected menu header
if (_selectedMenu)
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp
index e86a95198a..040da94347 100644
--- a/engines/lure/res_struct.cpp
+++ b/engines/lure/res_struct.cpp
@@ -150,7 +150,7 @@ bool RoomExitData::insideRect(int16 xp, int16 yp) {
RoomExitData *RoomExitList::checkExits(int16 xp, int16 yp) {
iterator i;
- for (i = begin(); i != end(); i++) {
+ for (i = begin(); i != end(); ++i) {
RoomExitData *rec = (*i).get();
if (rec->insideRect(xp, yp)) {
return rec;
diff --git a/engines/lure/room.cpp b/engines/lure/room.cpp
index 6dddffac9c..7b61f39785 100644
--- a/engines/lure/room.cpp
+++ b/engines/lure/room.cpp
@@ -116,10 +116,9 @@ Room::Room(): _screen(Screen::getReference()) {
Room::~Room() {
for (int layerNum = 0; layerNum < _numLayers; ++layerNum)
- if (_layers[layerNum])
- delete _layers[layerNum];
+ delete _layers[layerNum];
- if (_talkDialog) delete _talkDialog;
+ delete _talkDialog;
int_room = NULL;
}
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 674d0209d3..be57c52b47 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -82,8 +82,7 @@ SoundManager::~SoundManager() {
g_system->unlockMutex(_soundMutex);
delete _descs;
- if (_soundData)
- delete _soundData;
+ delete _soundData;
if (_driver) {
_driver->close();
@@ -641,8 +640,7 @@ MidiMusic::~MidiMusic() {
_parser->unloadMusic();
delete _parser;
this->close();
- if (_decompressedSound != NULL)
- delete _decompressedSound;
+ delete _decompressedSound;
}
void MidiMusic::setVolume(int volume) {
diff --git a/engines/m4/actor.cpp b/engines/m4/actor.cpp
index bfb4a14615..82f7361cca 100644
--- a/engines/m4/actor.cpp
+++ b/engines/m4/actor.cpp
@@ -95,8 +95,7 @@ void Actor::unloadWalkers() {
continue; // walker sprite 6 is unused
SpriteAsset *tempSprite = _walkerSprites[i];
_walkerSprites.remove_at(i);
- if (tempSprite)
- delete tempSprite;
+ delete tempSprite;
}
}
diff --git a/engines/m4/events.cpp b/engines/m4/events.cpp
index 751fe8a353..099aa6b48d 100644
--- a/engines/m4/events.cpp
+++ b/engines/m4/events.cpp
@@ -186,8 +186,7 @@ Mouse::Mouse(M4Engine *vm) : _vm(vm) {
}
Mouse::~Mouse() {
- if (_cursorSprites)
- delete _cursorSprites;
+ delete _cursorSprites;
}
bool Mouse::init(const char *seriesName, RGB8 *palette) {
diff --git a/engines/m4/globals.cpp b/engines/m4/globals.cpp
index b21c17edd8..6461025165 100644
--- a/engines/m4/globals.cpp
+++ b/engines/m4/globals.cpp
@@ -397,7 +397,7 @@ const char *Globals::loadMessage(uint index) {
if (buffer[i] == '\0') buffer[i] = '\n';
_vm->res()->toss("messages.dat");
- delete compData;
+ delete[] compData;
return (char*)buffer;
}
diff --git a/engines/m4/gui.cpp b/engines/m4/gui.cpp
index e11a654e64..dc75b94fd7 100644
--- a/engines/m4/gui.cpp
+++ b/engines/m4/gui.cpp
@@ -90,8 +90,7 @@ MenuObject::MenuObject(DialogView *owner, int objectId, int xs, int ys, int widt
}
MenuObject::~MenuObject() {
- if (_background)
- delete _background;
+ delete _background;
}
void MenuObject::onExecute() {
diff --git a/engines/m4/m4_menus.cpp b/engines/m4/m4_menus.cpp
index 220f58aac9..827d1ac3f8 100644
--- a/engines/m4/m4_menus.cpp
+++ b/engines/m4/m4_menus.cpp
@@ -433,10 +433,8 @@ OrionMenuView::~OrionMenuView() {
delete *i;
_menuObjects.clear();
- if (_saveNames)
- delete _saveNames;
- if (_savegameThumbnail)
- delete _savegameThumbnail;
+ delete _saveNames;
+ delete _savegameThumbnail;
}
bool OrionMenuView::loadSprites(const char *seriesName) {
diff --git a/engines/m4/mads_anim.cpp b/engines/m4/mads_anim.cpp
index c8e0ddd89d..76f6fd712d 100644
--- a/engines/m4/mads_anim.cpp
+++ b/engines/m4/mads_anim.cpp
@@ -75,12 +75,9 @@ TextviewView::TextviewView(M4Engine *vm):
TextviewView::~TextviewView() {
if (_script)
_vm->res()->toss(_resourceName);
- if (_spareScreen)
- delete _spareScreen;
- if (_bgCurrent)
- delete _bgCurrent;
- if (_bgSpare)
- delete _bgSpare;
+ delete _spareScreen;
+ delete _bgCurrent;
+ delete _bgSpare;
}
void TextviewView::reset() {
diff --git a/engines/m4/mads_menus.cpp b/engines/m4/mads_menus.cpp
index 2f5a0107bd..196f7ff7b0 100644
--- a/engines/m4/mads_menus.cpp
+++ b/engines/m4/mads_menus.cpp
@@ -74,8 +74,7 @@ RexMainMenuView::RexMainMenuView(M4Engine *vm):
}
RexMainMenuView::~RexMainMenuView() {
- if (_menuItem)
- delete _menuItem;
+ delete _menuItem;
_vm->_palette->deleteRange(_bgPalData);
@@ -121,8 +120,7 @@ bool RexMainMenuView::onEvent(M4EventType eventType, int32 param, int x, int y,
// Goodness knows why, but Rex has a key to restart the menuitem animations
// Delete the current menu items
- if (_menuItem)
- delete _menuItem;
+ delete _menuItem;
_vm->_palette->deleteRange(_bgPalData);
delete _bgPalData;
diff --git a/engines/m4/midi.cpp b/engines/m4/midi.cpp
index 201d7d3f5f..2696bf566a 100644
--- a/engines/m4/midi.cpp
+++ b/engines/m4/midi.cpp
@@ -47,9 +47,7 @@ MidiPlayer::~MidiPlayer() {
stopMusic();
close();
delete _parser;
-
- if (_midiData)
- free(_midiData);
+ free(_midiData);
}
void MidiPlayer::setVolume(int volume) {
diff --git a/engines/m4/scene.cpp b/engines/m4/scene.cpp
index 905cb744c3..f61a2e88ce 100644
--- a/engines/m4/scene.cpp
+++ b/engines/m4/scene.cpp
@@ -73,21 +73,13 @@ Scene::~Scene() {
delete _backgroundSurface;
delete _codeSurface;
-
- if (_sceneSprites)
- delete _sceneSprites;
+ delete _sceneSprites;
// _vm->_palette->deleteAllRanges();
- if (_palData)
- delete _palData;
-
- if (_interfacePal)
- delete _interfacePal;
-
- if (_inverseColorTable)
- delete[] _inverseColorTable;
-
+ delete _palData;
+ delete _interfacePal;
+ delete[] _inverseColorTable;
}
void Scene::loadScene(int sceneNumber) {
@@ -284,8 +276,7 @@ void Scene::loadSceneInverseColorTable(int sceneNumber) {
if (_vm->isM4()) {
sprintf(filename, "%i.ipl", sceneNumber);
iplS = _vm->res()->openFile(filename);
- if (_inverseColorTable)
- delete[] _inverseColorTable;
+ delete[] _inverseColorTable;
_inverseColorTable = new byte[iplS->size()];
iplS->read(_inverseColorTable, iplS->size());
_vm->res()->toss(filename);
diff --git a/engines/m4/script.cpp b/engines/m4/script.cpp
index c74d533093..6a2841053c 100644
--- a/engines/m4/script.cpp
+++ b/engines/m4/script.cpp
@@ -101,8 +101,7 @@ StringTable::StringTable() : _stringsData(NULL) {
}
StringTable::~StringTable() {
- if (_stringsData)
- delete[] _stringsData;
+ delete[] _stringsData;
}
void StringTable::load(Common::File *fd) {
@@ -191,8 +190,7 @@ ScriptFunction::ScriptFunction(ScriptInterpreter *inter) : _inter(inter) {
}
ScriptFunction::~ScriptFunction() {
- if (_code)
- delete _code;
+ delete _code;
}
void ScriptFunction::load(Common::File *fd) {
@@ -293,9 +291,7 @@ void ScriptInterpreter::open(const char *filename) {
}
void ScriptInterpreter::close() {
- if (_scriptFile) {
- delete _scriptFile;
- }
+ delete _scriptFile;
}
void ScriptInterpreter::initScriptKernel() {
diff --git a/engines/m4/woodscript.cpp b/engines/m4/woodscript.cpp
index 25cfaa7664..036f5d101f 100644
--- a/engines/m4/woodscript.cpp
+++ b/engines/m4/woodscript.cpp
@@ -180,7 +180,7 @@ Sequence *WoodScript::createSequence(Machine *machine, int32 sequenceHash) {
void WoodScript::runSequencePrograms() {
// A lot TODO
- for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); it++) {
+ for (Common::Array<Sequence*>::iterator it = _sequences.begin(); it != _sequences.end(); ++it) {
Sequence *sequence = *it;
if (sequence->isActive()) {
sequence->runProgram();
diff --git a/engines/made/database.cpp b/engines/made/database.cpp
index 6fad8e881b..ae1a08e1b5 100644
--- a/engines/made/database.cpp
+++ b/engines/made/database.cpp
@@ -255,8 +255,7 @@ GameDatabase::GameDatabase(MadeEngine *vm) : _vm(vm) {
}
GameDatabase::~GameDatabase() {
- if (_gameState)
- delete[] _gameState;
+ delete[] _gameState;
}
void GameDatabase::open(const char *filename) {
@@ -388,8 +387,7 @@ GameDatabaseV2::GameDatabaseV2(MadeEngine *vm) : GameDatabase(vm), _gameText(NUL
}
GameDatabaseV2::~GameDatabaseV2() {
- if (_gameText)
- delete[] _gameText;
+ delete[] _gameText;
}
void GameDatabaseV2::load(Common::SeekableReadStream &sourceS) {
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 5fe67b3ba1..ee41fe3cda 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -115,9 +115,7 @@ bool PmvPlayer::play(const char *filename) {
// Only reallocate the frame data buffer if its size has changed
if (prevChunkSize != chunkSize || !frameData) {
- if (frameData)
- delete[] frameData;
-
+ delete[] frameData;
frameData = new byte[chunkSize];
}
diff --git a/engines/made/resource.cpp b/engines/made/resource.cpp
index 36a1c4c71c..22e3149b12 100644
--- a/engines/made/resource.cpp
+++ b/engines/made/resource.cpp
@@ -310,8 +310,7 @@ FontResource::FontResource() : _data(NULL), _size(0) {
}
FontResource::~FontResource() {
- if (_data)
- delete[] _data;
+ delete[] _data;
}
void FontResource::load(byte *source, int size) {
@@ -362,8 +361,7 @@ GenericResource::GenericResource() : _data(NULL), _size(0) {
}
GenericResource::~GenericResource() {
- if (_data)
- delete[] _data;
+ delete[] _data;
}
void GenericResource::load(byte *source, int size) {
diff --git a/engines/parallaction/gui.cpp b/engines/parallaction/gui.cpp
index ee8d040f44..c4a36e5362 100644
--- a/engines/parallaction/gui.cpp
+++ b/engines/parallaction/gui.cpp
@@ -47,7 +47,7 @@ bool MenuInputHelper::run() {
MenuInputHelper::~MenuInputHelper() {
StateMap::iterator b = _map.begin();
- for ( ; b != _map.end(); b++) {
+ for ( ; b != _map.end(); ++b) {
delete b->_value;
}
_map.clear();
diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp
index fe2373e4e2..4a39b0d385 100644
--- a/engines/sci/gfx/gfx_resource.cpp
+++ b/engines/sci/gfx/gfx_resource.cpp
@@ -66,11 +66,9 @@ void gfxr_free_pic(gfxr_pic_t *pic) {
pic->visual_map = NULL;
pic->priority_map = NULL;
pic->control_map = NULL;
- if (pic->priorityTable)
- free(pic->priorityTable);
+ free(pic->priorityTable);
pic->priorityTable = NULL;
- if (pic->undithered_buffer)
- free(pic->undithered_buffer);
+ free(pic->undithered_buffer);
pic->undithered_buffer = 0;
free(pic);
}
diff --git a/engines/sci/gui/gui_animate.cpp b/engines/sci/gui/gui_animate.cpp
index f7e53fa196..16e67873aa 100644
--- a/engines/sci/gui/gui_animate.cpp
+++ b/engines/sci/gui/gui_animate.cpp
@@ -44,10 +44,8 @@ SciGuiAnimate::SciGuiAnimate(EngineState *state, SciGuiGfx *gfx, SciGuiScreen *s
}
SciGuiAnimate::~SciGuiAnimate() {
- if (_listData)
- free(_listData);
- if (_lastCastData)
- free(_lastCastData);
+ free(_listData);
+ free(_lastCastData);
}
void SciGuiAnimate::init() {
@@ -129,15 +127,13 @@ void SciGuiAnimate::makeSortedList(List *list) {
// Adjust list size, if needed
if ((_listData == NULL) || (_listCount < listCount)) {
- if (_listData)
- free(_listData);
+ free(_listData);
_listData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry));
if (!_listData)
error("Could not allocate memory for _listData");
_listCount = listCount;
- if (_lastCastData)
- free(_lastCastData);
+ free(_lastCastData);
_lastCastData = (GuiAnimateEntry *)malloc(listCount * sizeof(GuiAnimateEntry));
if (!_lastCastData)
error("Could not allocate memory for _lastCastData");
diff --git a/engines/sci/gui/gui_text.cpp b/engines/sci/gui/gui_text.cpp
index 21e92f9617..218008a95e 100644
--- a/engines/sci/gui/gui_text.cpp
+++ b/engines/sci/gui/gui_text.cpp
@@ -74,9 +74,7 @@ void SciGuiText::SetFont(GuiResourceId fontId) {
void SciGuiText::CodeSetFonts(int argc, reg_t *argv) {
int i;
- if (_codeFonts) {
- delete _codeFonts;
- }
+ delete _codeFonts;
_codeFontsCount = argc;
_codeFonts = new GuiResourceId[argc];
for (i = 0; i < argc; i++) {
@@ -87,9 +85,7 @@ void SciGuiText::CodeSetFonts(int argc, reg_t *argv) {
void SciGuiText::CodeSetColors(int argc, reg_t *argv) {
int i;
- if (_codeColors) {
- delete _codeColors;
- }
+ delete _codeColors;
_codeColorsCount = argc;
_codeColors = new uint16[argc];
for (i = 0; i < argc; i++) {
diff --git a/engines/sci/gui32/res_pal.cpp b/engines/sci/gui32/res_pal.cpp
index a4319afcd6..38a0eb5b60 100644
--- a/engines/sci/gui32/res_pal.cpp
+++ b/engines/sci/gui32/res_pal.cpp
@@ -125,6 +125,7 @@ Palette *gfxr_read_pal1_amiga(Common::File &file) {
b2 = file.readByte();
if (b1 == EOF || b2 == EOF) {
+ delete retval;
error("Amiga palette file ends prematurely");
return NULL;
}
diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp
index 92b83d97f2..1b0f00f41f 100644
--- a/engines/sci/sfx/music.cpp
+++ b/engines/sci/sfx/music.cpp
@@ -332,8 +332,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
// play digital sample
if (track->digitalChannelNr != -1) {
byte *channelData = track->channels[track->digitalChannelNr].data;
- if (pSnd->pStreamAud)
- delete pSnd->pStreamAud;
+ delete pSnd->pStreamAud;
pSnd->pStreamAud = Audio::makeLinearInputStream(channelData, track->digitalSampleSize, track->digitalSampleRate,
Audio::Mixer::FLAG_UNSIGNED, 0, 0);
pSnd->soundType = Audio::Mixer::kSFXSoundType;
diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp
index 1ecf22c925..e2af0a0767 100644
--- a/engines/sci/sfx/softseq/adlib.cpp
+++ b/engines/sci/sfx/softseq/adlib.cpp
@@ -238,9 +238,7 @@ void MidiDriver_Adlib::close() {
_mixer->stopHandle(_mixerSoundHandle);
delete _opl;
-
- if (_rhythmKeyMap)
- delete[] _rhythmKeyMap;
+ delete[] _rhythmKeyMap;
}
void MidiDriver_Adlib::setVolume(byte volume) {
diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp
index 6dc31b09ef..6b68b5d804 100644
--- a/engines/scumm/file.cpp
+++ b/engines/scumm/file.cpp
@@ -399,9 +399,7 @@ bool ScummDiskImage::generateIndex() {
extractIndex(&out);
- if (_stream)
- delete _stream;
-
+ delete _stream;
_stream = new Common::MemoryReadStream(_buf, bufsize);
return true;
diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp
index ce29bf0319..824f998def 100644
--- a/engines/scumm/he/resource_he.cpp
+++ b/engines/scumm/he/resource_he.cpp
@@ -983,10 +983,8 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
}
- if (row != NULL)
- free(row);
- if (palette != NULL)
- free(palette);
+ free(row);
+ free(palette);
if (image_data != NULL) {
free(image_data);
free(mask_data);
@@ -995,10 +993,8 @@ int Win32ResExtractor::convertIcons(byte *data, int datasize, byte **cursor, int
local_cleanup:
- if (row != NULL)
- free(row);
- if (palette != NULL)
- free(palette);
+ free(row);
+ free(palette);
if (image_data != NULL) {
free(image_data);
free(mask_data);
diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp
index 78aba6ced1..4376a94d99 100644
--- a/engines/scumm/imuse/imuse_player.cpp
+++ b/engines/scumm/imuse/imuse_player.cpp
@@ -188,8 +188,7 @@ int Player::start_seq_sound(int sound, bool reset_vars) {
ptr = _se->findStartOfSound(sound);
if (ptr == NULL)
return -1;
- if (_parser)
- delete _parser;
+ delete _parser;
if (!memcmp(ptr, "RO", 2)) {
// Old style 'RO' resource
diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp
index cadafd412a..bc8380f1b1 100644
--- a/engines/scumm/imuse/instrument.cpp
+++ b/engines/scumm/imuse/instrument.cpp
@@ -273,8 +273,7 @@ void Instrument::nativeMT32(bool native) {
}
void Instrument::clear() {
- if (_instrument)
- delete _instrument;
+ delete _instrument;
_instrument = NULL;
_type = itNone;
}
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index bd6d582c99..225d7573bf 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -647,12 +647,8 @@ void SmushPlayer::handleTextResource(uint32 subType, int32 subSize, Common::Seek
error("SmushPlayer::handleTextResource. Not handled flags: %d", flags);
}
- if (string != NULL) {
- free (string);
- }
- if (string3 != NULL) {
- free (string3);
- }
+ free(string);
+ free(string3);
}
const char *SmushPlayer::getString(int id) {
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp
index 2e17d2595f..30c616f12d 100644
--- a/engines/sky/control.cpp
+++ b/engines/sky/control.cpp
@@ -165,8 +165,7 @@ ControlStatus::ControlStatus(Text *skyText, OSystem *system, uint8 *scrBuf) {
}
ControlStatus::~ControlStatus() {
- if (_textData)
- free(_textData);
+ free(_textData);
delete _statusText;
}
@@ -184,8 +183,7 @@ void ControlStatus::setToText(const char *newText) {
}
void ControlStatus::setToText(uint16 textNum) {
- if (_textData)
- free(_textData);
+ free(_textData);
DisplayedText disText = _skyText->displayText(textNum, NULL, true, STATUS_WIDTH, 255);
_textData = (DataFileHeader *)disText.textData;
_statusText->setSprite(_textData);
@@ -330,16 +328,14 @@ void Control::initPanel() {
void Control::buttonControl(ConResource *pButton) {
char autoSave[] = "Restore Autosave";
if (pButton == NULL) {
- if (_textSprite)
- free(_textSprite);
+ free(_textSprite);
_textSprite = NULL;
_curButtonText = 0;
_text->setSprite(NULL);
return;
}
if (_curButtonText != pButton->_text) {
- if (_textSprite)
- free(_textSprite);
+ free(_textSprite);
_textSprite = NULL;
_curButtonText = pButton->_text;
if (pButton->_text) {
@@ -647,8 +643,7 @@ bool Control::getYesNo(char *text) {
}
_mouseClicked = false;
_skyMouse->spriteMouse(MOUSE_NORMAL, 0, 0);
- if (dlgTextDat)
- free(dlgTextDat);
+ free(dlgTextDat);
delete dlgText;
return retVal;
}
diff --git a/engines/sky/detection.cpp b/engines/sky/detection.cpp
index 1a14703972..8feffab6e6 100644
--- a/engines/sky/detection.cpp
+++ b/engines/sky/detection.cpp
@@ -206,7 +206,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
saveList.insert_at(0, SaveStateDescriptor(0, "*AUTOSAVE*"));
// Prepare the list of savestates by looping over all matching savefiles
- for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); file++) {
+ for (Common::StringList::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
// Extract the extension
Common::String ext = file->c_str() + file->size() - 3;
ext.toUppercase();
diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp
index bb715442bb..ae6e445303 100644
--- a/engines/sky/intro.cpp
+++ b/engines/sky/intro.cpp
@@ -743,8 +743,7 @@ bool Intro::nextPart(uint16 *&data) {
return true;
case LOADBG:
_mixer->stopID(SOUND_BG);
- if (_bgBuf)
- free(_bgBuf);
+ free(_bgBuf);
_bgBuf = _skyDisk->loadFile(*data++);
_bgSize = _skyDisk->_lastLoadedFileSize;
return true;
diff --git a/engines/sky/music/musicbase.cpp b/engines/sky/music/musicbase.cpp
index a4eeaa017d..0d3cb65e1b 100644
--- a/engines/sky/music/musicbase.cpp
+++ b/engines/sky/music/musicbase.cpp
@@ -40,16 +40,14 @@ MusicBase::MusicBase(Disk *pDisk) {
MusicBase::~MusicBase() {
stopMusic();
- if (_musicData)
- free(_musicData);
+ free(_musicData);
}
void MusicBase::loadSection(uint8 pSection) {
_mutex.lock();
if (_currentMusic)
stopMusicInternal();
- if (_musicData)
- free(_musicData);
+ free(_musicData);
_currentSection = pSection;
_musicData = _skyDisk->loadFile(_driverFileBase + FILES_PER_SECTION * pSection);
diff --git a/engines/sky/screen.cpp b/engines/sky/screen.cpp
index 86949eb73e..fb42da4b97 100644
--- a/engines/sky/screen.cpp
+++ b/engines/sky/screen.cpp
@@ -93,10 +93,8 @@ Screen::Screen(OSystem *pSystem, Disk *pDisk, SkyCompact *skyCompact) {
Screen::~Screen() {
free(_gameGrid);
- if (_currentScreen)
- free(_currentScreen);
- if (_scrollScreen)
- free(_scrollScreen);
+ free(_currentScreen);
+ free(_scrollScreen);
}
void Screen::clearScreen() {
@@ -151,8 +149,7 @@ void Screen::setPalette(uint16 fileNum) {
void Screen::showScreen(uint16 fileNum) {
// This is only used for static images in the floppy and cd intro
- if (_currentScreen)
- free(_currentScreen);
+ free(_currentScreen);
_currentScreen = _skyDisk->loadFile(fileNum);
// make sure the last 8 lines are forced to black.
memset(_currentScreen + GAME_SCREEN_HEIGHT * GAME_SCREEN_WIDTH, 0, (FULL_SCREEN_HEIGHT - GAME_SCREEN_HEIGHT) * GAME_SCREEN_WIDTH);
diff --git a/engines/sky/sound.cpp b/engines/sky/sound.cpp
index c4bfd52b64..67cb1b8fbd 100644
--- a/engines/sky/sound.cpp
+++ b/engines/sky/sound.cpp
@@ -1030,8 +1030,7 @@ Sound::Sound(Audio::Mixer *mixer, Disk *pDisk, uint8 pVolume) {
Sound::~Sound() {
_mixer->stopAll();
- if (_soundData)
- free(_soundData);
+ free(_soundData);
}
void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle) {
@@ -1049,8 +1048,7 @@ void Sound::loadSection(uint8 pSection) {
fnStopFx();
_mixer->stopAll();
- if (_soundData)
- free(_soundData);
+ free(_soundData);
_soundData = _skyDisk->loadFile(pSection * 4 + SOUND_FILE_BASE);
uint16 asmOfs;
if (SkyEngine::_systemVars.gameVersion == 109) {
diff --git a/engines/sky/text.cpp b/engines/sky/text.cpp
index 66e03b08bc..73c376dbbe 100644
--- a/engines/sky/text.cpp
+++ b/engines/sky/text.cpp
@@ -78,12 +78,9 @@ Text::~Text() {
SkyEngine::_itemList[i] = NULL;
}
- if (_mainCharacterSet.addr)
- free(_mainCharacterSet.addr);
- if (_controlCharacterSet.addr)
- free(_controlCharacterSet.addr);
- if (_linkCharacterSet.addr)
- free(_linkCharacterSet.addr);
+ free(_mainCharacterSet.addr);
+ free(_controlCharacterSet.addr);
+ free(_linkCharacterSet.addr);
}
void Text::fnSetFont(uint32 fontNr) {
diff --git a/engines/sword1/resman.cpp b/engines/sword1/resman.cpp
index 3b11f6cca5..41f952c3f4 100644
--- a/engines/sword1/resman.cpp
+++ b/engines/sword1/resman.cpp
@@ -166,9 +166,7 @@ void ResMan::freeCluDescript() {
}
}
delete[] cluster->grp;
-
- if (cluster->file != NULL)
- delete cluster->file;
+ delete cluster->file;
}
delete[] _prj.clu;
}
diff --git a/engines/sword1/screen.cpp b/engines/sword1/screen.cpp
index 928cfafd10..024b681acb 100644
--- a/engines/sword1/screen.cpp
+++ b/engines/sword1/screen.cpp
@@ -314,10 +314,8 @@ void Screen::newScreen(uint32 screen) {
Logic::_scriptVars[SCROLL_OFFSET_X] = 0;
Logic::_scriptVars[SCROLL_OFFSET_Y] = 0;
- if (_screenBuf)
- free(_screenBuf);
- if (_screenGrid)
- free(_screenGrid);
+ free(_screenBuf);
+ free(_screenGrid);
if (SwordEngine::isPsx())
flushPsxCache();
@@ -554,11 +552,8 @@ void Screen::processImage(uint32 id) {
if (compact->o_type != TYPE_TEXT)
_resMan->resClose(compact->o_resource);
- if (tonyBuf)
- free(tonyBuf);
-
- if (hifBuf)
- free(hifBuf);
+ free(tonyBuf);
+ free(hifBuf);
}
void Screen::verticalMask(uint16 x, uint16 y, uint16 bWidth, uint16 bHeight) {
diff --git a/sound/midiparser_smf.cpp b/sound/midiparser_smf.cpp
index 89b7d3f525..4261b1d770 100644
--- a/sound/midiparser_smf.cpp
+++ b/sound/midiparser_smf.cpp
@@ -52,8 +52,7 @@ static const byte command_lengths[8] = { 3, 3, 3, 3, 2, 2, 3, 0 };
static const byte special_lengths[16] = { 0, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
MidiParser_SMF::~MidiParser_SMF() {
- if (_buffer)
- free(_buffer);
+ free(_buffer);
}
void MidiParser_SMF::property(int prop, int value) {
diff --git a/sound/mods/infogrames.cpp b/sound/mods/infogrames.cpp
index 9d3d6b8562..c2631dc079 100644
--- a/sound/mods/infogrames.cpp
+++ b/sound/mods/infogrames.cpp
@@ -34,8 +34,7 @@ Infogrames::Instruments::Instruments() {
}
Infogrames::Instruments::~Instruments() {
- if (_sampleData)
- delete[] _sampleData;
+ delete[] _sampleData;
}
void Infogrames::Instruments::init() {
@@ -104,8 +103,7 @@ bool Infogrames::Instruments::load(Common::SeekableReadStream &ins) {
}
void Infogrames::Instruments::unload() {
- if (_sampleData)
- delete[] _sampleData;
+ delete[] _sampleData;
init();
}
@@ -142,8 +140,7 @@ Infogrames::Infogrames(Instruments &ins, bool stereo, int rate,
}
Infogrames::~Infogrames() {
- if (_data)
- delete[] _data;
+ delete[] _data;
}
void Infogrames::init() {
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index dde6b4f559..654aca9294 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -248,8 +248,7 @@ MidiDriver_MT32::MidiDriver_MT32(Audio::Mixer *mixer) : MidiDriver_Emulated(mixe
}
MidiDriver_MT32::~MidiDriver_MT32() {
- if (_synth != NULL)
- delete _synth;
+ delete _synth;
}
int MidiDriver_MT32::open() {
diff --git a/sound/softsynth/mt32/synth.cpp b/sound/softsynth/mt32/synth.cpp
index 0f0d15686c..b3f8d81719 100644
--- a/sound/softsynth/mt32/synth.cpp
+++ b/sound/softsynth/mt32/synth.cpp
@@ -129,8 +129,7 @@ void Synth::printDebug(const char *fmt, ...) {
void Synth::initReverb(Bit8u newRevMode, Bit8u newRevTime, Bit8u newRevLevel) {
// FIXME:KG: I don't think it's necessary to recreate the reverbModel... Just set the parameters
- if (reverbModel != NULL)
- delete reverbModel;
+ delete reverbModel;
reverbModel = new revmodel();
switch (newRevMode) {