mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 21:54:33 +08:00
android/haltest: Close file in case of error
This commit is contained in:
parent
7bb2a16843
commit
a7032c97ef
@ -258,19 +258,26 @@ static void play_p(int argc, const char **argv)
|
||||
|
||||
if (buffer_size == 0) {
|
||||
haltest_error("Invalid buffer size. Was stream_out opened?\n");
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&state_mutex);
|
||||
if (current_state != STATE_STOPPED) {
|
||||
haltest_error("Already playing or stream suspended!\n");
|
||||
pthread_mutex_unlock(&state_mutex);
|
||||
return;
|
||||
goto fail;
|
||||
}
|
||||
pthread_mutex_unlock(&state_mutex);
|
||||
|
||||
if (pthread_create(&play_thread, NULL, playback_thread, in) != 0)
|
||||
if (pthread_create(&play_thread, NULL, playback_thread, in) != 0) {
|
||||
haltest_error("Cannot create playback thread!\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return;
|
||||
fail:
|
||||
if (in)
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
static void stop_p(int argc, const char **argv)
|
||||
|
Loading…
Reference in New Issue
Block a user