diff options
author | Torbjörn Andersson | 2018-08-27 06:40:48 +0200 |
---|---|---|
committer | Torbjörn Andersson | 2018-08-27 06:43:47 +0200 |
commit | 54d7336d0886d0a9960baba71168c3471cdb84c6 (patch) | |
tree | 1dee9cffec18df510a26842cd629522bfa251f9e /audio | |
parent | bfded218496afa3dc4d173d71b30f67fcc8e6390 (diff) | |
download | scummvm-rg350-54d7336d0886d0a9960baba71168c3471cdb84c6.tar.gz scummvm-rg350-54d7336d0886d0a9960baba71168c3471cdb84c6.tar.bz2 scummvm-rg350-54d7336d0886d0a9960baba71168c3471cdb84c6.zip |
AUDIO: Free strings with delete[] instead of free()
Because scumm_strdup(), unlike strdup(), allocates strings with
new, not malloc(). (CID 1395228, 1395233, 1395235, 1395236)
Diffstat (limited to 'audio')
-rw-r--r-- | audio/softsynth/fluidsynth.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/audio/softsynth/fluidsynth.cpp b/audio/softsynth/fluidsynth.cpp index 5c14f33a60..4034b2ffc3 100644 --- a/audio/softsynth/fluidsynth.cpp +++ b/audio/softsynth/fluidsynth.cpp @@ -87,18 +87,21 @@ MidiDriver_FluidSynth::MidiDriver_FluidSynth(Audio::Mixer *mixer) _outputRate = 96000; } +// The string duplication below is there only because older versions (1.1.6 +// and earlier?) of FluidSynth expected the string parameters to be non-const. + void MidiDriver_FluidSynth::setInt(const char *name, int val) { char *name2 = scumm_strdup(name); fluid_settings_setint(_settings, name2, val); - free(name2); + delete[] name2; } void MidiDriver_FluidSynth::setNum(const char *name, double val) { char *name2 = scumm_strdup(name); fluid_settings_setnum(_settings, name2, val); - free(name2); + delete[] name2; } void MidiDriver_FluidSynth::setStr(const char *name, const char *val) { @@ -106,8 +109,8 @@ void MidiDriver_FluidSynth::setStr(const char *name, const char *val) { char *val2 = scumm_strdup(val); fluid_settings_setstr(_settings, name2, val2); - free(name2); - free(val2); + delete[] name2; + delete[] val2; } int MidiDriver_FluidSynth::open() { |