mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 20:27:23 +00:00
audio: fix crash during uninit on ao_lavc
The buffer state can be null when using --ao=lavc, so just check it first. Fixes #10175.
This commit is contained in:
parent
95a76f0692
commit
9a9039deb2
@ -459,7 +459,7 @@ void ao_uninit(struct ao *ao)
|
||||
{
|
||||
struct buffer_state *p = ao->buffer_state;
|
||||
|
||||
if (p->thread_valid) {
|
||||
if (p && p->thread_valid) {
|
||||
pthread_mutex_lock(&p->pt_lock);
|
||||
p->terminate = true;
|
||||
pthread_cond_broadcast(&p->pt_wakeup);
|
||||
@ -472,6 +472,7 @@ void ao_uninit(struct ao *ao)
|
||||
if (ao->driver_initialized)
|
||||
ao->driver->uninit(ao);
|
||||
|
||||
if (p) {
|
||||
talloc_free(p->filter_root);
|
||||
talloc_free(p->queue);
|
||||
talloc_free(p->pending);
|
||||
@ -483,6 +484,7 @@ void ao_uninit(struct ao *ao)
|
||||
|
||||
pthread_cond_destroy(&p->pt_wakeup);
|
||||
pthread_mutex_destroy(&p->pt_lock);
|
||||
}
|
||||
|
||||
talloc_free(ao);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user