DIRECTOR: Fix memory leaks

This commit is contained in:
Eugene Sandulenko 2020-04-03 22:34:59 +02:00
parent 0c940567dd
commit edb2edf3f4
2 changed files with 7 additions and 4 deletions

View File

@ -399,6 +399,8 @@ void Lingo::func_cursor(int c, int m) {
warning("STUB: func_cursor(): Hotspot is the registration point of the cast member"); warning("STUB: func_cursor(): Hotspot is the registration point of the cast member");
_vm->getMacWindowManager()->pushCustomCursor(assembly, 16, 16, 1, 1, 3); _vm->getMacWindowManager()->pushCustomCursor(assembly, 16, 16, 1, 1, 3);
free(assembly);
return; return;
} }

View File

@ -88,13 +88,14 @@ void DirectorSound::playFile(Common::String filename, uint8 soundChannel) {
} }
void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) { void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
Common::File *file = new Common::File();
if (soundChannel == 0 || soundChannel > _channels.size()) { if (soundChannel == 0 || soundChannel > _channels.size()) {
warning("Invalid sound channel %d", soundChannel); warning("Invalid sound channel %d", soundChannel);
return; return;
} }
Common::File *file = new Common::File();
if (!file->open(filename)) { if (!file->open(filename)) {
warning("Failed to open %s", filename.c_str()); warning("Failed to open %s", filename.c_str());
@ -110,13 +111,13 @@ void DirectorSound::playWAV(Common::String filename, uint8 soundChannel) {
} }
void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) { void DirectorSound::playAIFF(Common::String filename, uint8 soundChannel) {
Common::File *file = new Common::File();
if (soundChannel == 0 || soundChannel > _channels.size()) { if (soundChannel == 0 || soundChannel > _channels.size()) {
warning("Invalid sound channel %d", soundChannel); warning("Invalid sound channel %d", soundChannel);
return; return;
} }
Common::File *file = new Common::File();
if (!file->open(filename)) { if (!file->open(filename)) {
warning("Failed to open %s", filename.c_str()); warning("Failed to open %s", filename.c_str());
delete file; delete file;