Skip to content

Commit

Permalink
chore: close ALSA handle before throwing Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmarble committed Jul 30, 2022
1 parent 7289044 commit 668783f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions darkice/trunk/src/AlsaDspSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,17 @@ AlsaDspSource :: read ( void * buf,
} while (ret == -EAGAIN);

if ( ret == -EBADFD ) {
throw Exception(__FILE__, __LINE__,
"ALSA/PCM device is in a bad state: ",
std::to_string(snd_pcm_state(captureHandle)).c_str());
Exception e = Exception(__FILE__, __LINE__,
"ALSA/PCM device is in a bad state: ",
std::to_string(snd_pcm_state(captureHandle)).c_str());
close();
throw e;
}

if ( ret < 0 ) {
throw Exception(__FILE__, __LINE__, snd_strerror(ret));
Exception e = Exception(__FILE__, __LINE__, snd_strerror(ret));
close();
throw e;
}

running = true;
Expand Down

0 comments on commit 668783f

Please sign in to comment.