Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7e3be0ca authored by Leslie Zhai's avatar Leslie Zhai

Robust K3bMad's cleanup

CCBUG: 382468
parent 2ab8b001
......@@ -24,7 +24,11 @@ static const int INPUT_BUFFER_SIZE = 5*8192;
K3bMad::K3bMad()
: m_madStructuresInitialized(false),
m_bInputError(false)
m_bInputError(false),
madStream(NULL),
madFrame(NULL),
madSynth(NULL),
madTimer(NULL)
{
madStream = new mad_stream;
madFrame = new mad_frame;
......@@ -43,10 +47,10 @@ K3bMad::~K3bMad()
{
cleanup();
delete madStream;
delete madFrame;
delete madSynth;
delete madTimer;
if (madStream) delete madStream; madStream = NULL;
if (madFrame) delete madFrame; madFrame = NULL;
if (madSynth) delete madSynth; madSynth = NULL;
if (madTimer) delete madTimer; madTimer = NULL;
delete [] m_inputBuffer;
}
......@@ -265,10 +269,10 @@ void K3bMad::cleanup()
m_inputFile.close();
}
if( m_madStructuresInitialized ) {
mad_frame_finish( madFrame );
mad_synth_finish( madSynth );
mad_stream_finish( madStream );
if (m_madStructuresInitialized && madFrame && madSynth && madStream) {
mad_frame_finish(madFrame);
mad_synth_finish(madSynth);
mad_stream_finish(madStream);
}
m_madStructuresInitialized = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment