ao: fix crash after ao init failure (from recent 3a5fd15fa2)

If opening an audio output driver using the old API failed the
"global_ao" variable was not set back to NULL as it should have been.
This caused an assert failure the next time there was an attempt to
open such an AO (either due to fallback to another AO after the
failure or after moving to another file). Fix.
This commit is contained in:
Uoti Urpala 2011-05-16 01:22:47 +03:00
parent cbdb7e6305
commit bdcf4ddf35
1 changed files with 3 additions and 1 deletions

View File

@ -274,8 +274,10 @@ int old_ao_init(struct ao *ao, char *params)
global_ao = ao;
ao_subdevice = params ? talloc_strdup(ao, params) : NULL;
if (ao->driver->old_functions->init(ao->samplerate, ao->channels,
ao->format, 0) == 0)
ao->format, 0) == 0) {
global_ao = NULL;
return -1;
}
return 0;
}