Commit 9ddf97b4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

DirectSound: don't alloc p_sys if we're gonna fail

If DSOUND.DLL is unavailable, just fail fast.
parent 5ba5e472
......@@ -861,18 +861,20 @@ static int DeviceSelect (audio_output_t *aout, const char *id)
static int Open(vlc_object_t *obj)
{
audio_output_t *aout = (audio_output_t *)obj;
aout_sys_t *sys = calloc(1, sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
sys->hdsound_dll = LoadLibrary(_T("DSOUND.DLL"));
if (sys->hdsound_dll == NULL)
HINSTANCE hdsound_dll = LoadLibrary(_T("DSOUND.DLL"));
if (hdsound_dll == NULL)
{
msg_Warn(aout, "cannot open DSOUND.DLL");
free(sys);
return VLC_EGENERIC;
}
aout_sys_t *sys = calloc(1, sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
sys->hdsound_dll = hdsound_dll;
aout->sys = sys;
aout->start = Start;
aout->stop = Stop;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment