fix memory leak and log error checking
This commit is contained in:
parent
9b3214af37
commit
f0887bfd0a
@ -272,6 +272,7 @@ int sound_pa::init(osd_options const &options)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pa_error:
|
pa_error:
|
||||||
|
delete m_ab;
|
||||||
osd_printf_verbose("PortAudio error: %s\n", Pa_GetErrorText(err));
|
osd_printf_verbose("PortAudio error: %s\n", Pa_GetErrorText(err));
|
||||||
Pa_Terminate();
|
Pa_Terminate();
|
||||||
error:
|
error:
|
||||||
@ -406,17 +407,15 @@ void sound_pa::exit()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#if LOG_BUFCNT
|
#if LOG_BUFCNT
|
||||||
if (m_log.good())
|
std::ofstream m_logfile(LOG_FILE);
|
||||||
{
|
|
||||||
std::ofstream m_logfile(LOG_FILE);
|
|
||||||
|
|
||||||
if (m_logfile.is_open()) {
|
if (m_log.good() && m_logfile.is_open()) {
|
||||||
m_logfile << m_log.str();
|
m_logfile << m_log.str();
|
||||||
m_logfile.close();
|
m_logfile.close();
|
||||||
} else {
|
|
||||||
osd_printf_verbose("PortAudio: Could not write log.\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!m_log.good() || m_logfile.fail())
|
||||||
|
osd_printf_verbose("PortAudio: Error writing log.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Pa_StopStream(m_pa_stream);
|
Pa_StopStream(m_pa_stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user