aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/agos/drivers/accolade/adlib.cpp13
-rw-r--r--engines/agos/drivers/accolade/mt32.cpp13
2 files changed, 14 insertions, 12 deletions
diff --git a/engines/agos/drivers/accolade/adlib.cpp b/engines/agos/drivers/accolade/adlib.cpp
index ed05fe19ac..11edc7c5f7 100644
--- a/engines/agos/drivers/accolade/adlib.cpp
+++ b/engines/agos/drivers/accolade/adlib.cpp
@@ -872,13 +872,14 @@ MidiDriver *MidiDriver_Accolade_AdLib_create(Common::String driverFilename) {
error("ACCOLADE-ADLIB: error during readDriver()");
MidiDriver_Accolade_AdLib *driver = new MidiDriver_Accolade_AdLib(g_system->getMixer());
- if (!driver)
- return nullptr;
-
- if (!driver->setupInstruments(driverData, driverDataSize, isMusicDrvFile)) {
- delete driver;
- return nullptr;
+ if (driver) {
+ if (!driver->setupInstruments(driverData, driverDataSize, isMusicDrvFile)) {
+ delete driver;
+ driver = nullptr;
+ }
}
+
+ delete[] driverData;
return driver;
}
diff --git a/engines/agos/drivers/accolade/mt32.cpp b/engines/agos/drivers/accolade/mt32.cpp
index 2a023297ee..319e0ebf56 100644
--- a/engines/agos/drivers/accolade/mt32.cpp
+++ b/engines/agos/drivers/accolade/mt32.cpp
@@ -264,13 +264,14 @@ MidiDriver *MidiDriver_Accolade_MT32_create(Common::String driverFilename) {
error("ACCOLADE-ADLIB: error during readDriver()");
MidiDriver_Accolade_MT32 *driver = new MidiDriver_Accolade_MT32();
- if (!driver)
- return nullptr;
-
- if (!driver->setupInstruments(driverData, driverDataSize, isMusicDrvFile)) {
- delete driver;
- return nullptr;
+ if (driver) {
+ if (!driver->setupInstruments(driverData, driverDataSize, isMusicDrvFile)) {
+ delete driver;
+ driver = nullptr;
+ }
}
+
+ delete[] driverData;
return driver;
}