diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-08-28 18:53:20 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-08-28 18:53:20 +0900 |
commit | f0e311f71b7f02fb20e5db21a297a2c4caee9153 (patch) | |
tree | 7019eafa807997ac1b9791ae19d270d6bb030a4e /kmix/mixer.cpp | |
parent | 8f483a78ae1374422e094fbe5aa25068cc8d63f1 (diff) | |
download | tdemultimedia-f0e311f71b7f02fb20e5db21a297a2c4caee9153.tar.gz tdemultimedia-f0e311f71b7f02fb20e5db21a297a2c4caee9153.zip |
kmix: fixed memory leak associated with alsa. Various code improvements.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kmix/mixer.cpp')
-rw-r--r-- | kmix/mixer.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp index 62b6430a..778d6af9 100644 --- a/kmix/mixer.cpp +++ b/kmix/mixer.cpp @@ -80,7 +80,9 @@ bool Mixer::isValid(int driver, int device) Mixer_Backend *mb = mf(device); if (mb) { - return mb->isValid(); + bool ret = mb->isValid(); + delete mb; + return ret; } } return false; @@ -92,8 +94,8 @@ Mixer::Mixer( int driver, int device ) : DCOPObject( "Mixer" ) _mixerBackend = 0; getMixerFunc *f = g_mixerFactories[driver].getMixer; - if( f!=0 ) { - _mixerBackend = f( device ); + if (f) { + _mixerBackend = f(device ); } readSetFromHWforceUpdate(); // enforce an initial update on first readSetFromHW() @@ -120,6 +122,10 @@ Mixer::~Mixer() { // Close the mixer. This might also free memory, depending on the called backend method close(); delete _pollingTimer; + if (_mixerBackend) + { + delete _mixerBackend; + } } void Mixer::volumeSave( TDEConfig *config ) |