diff options
author | Chris Robinson <[email protected]> | 2018-02-12 20:48:28 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-02-12 20:48:28 -0800 |
commit | 4d417f3dd4c6fee0e5050768a231c65a700ee417 (patch) | |
tree | 712c17c72e06d855e88bfa7bd8c4e02c9e0b187c /Alc/panning.c | |
parent | dce497fbca5d3b3b843e4475a94febd9105de87c (diff) |
Make bformatdec_free and ambiup_free clear the freed pointer
Diffstat (limited to 'Alc/panning.c')
-rw-r--r-- | Alc/panning.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/Alc/panning.c b/Alc/panning.c index e368c946..b90652a3 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -1086,25 +1086,20 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf if(pconf && GetConfigValueBool(devname, "decoder", "hq-mode", 0)) { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + ambiup_free(&device->AmbiUp); if(!device->AmbiDecoder) device->AmbiDecoder = bformatdec_alloc(); } else { - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; - if(device->FmtChans == DevFmtAmbi3D && device->AmbiOrder > 1) + bformatdec_free(&device->AmbiDecoder); + if(device->FmtChans != DevFmtAmbi3D || device->AmbiOrder < 2) + ambiup_free(&device->AmbiUp); + else { if(!device->AmbiUp) device->AmbiUp = ambiup_alloc(); } - else - { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; - } } if(!pconf) @@ -1155,8 +1150,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf return; } - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; + bformatdec_free(&device->AmbiDecoder); headphones = device->IsHeadphones; if(device->Type != Loopback) @@ -1248,8 +1242,7 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf /* Don't bother with HOA when using full HRTF rendering. Nothing * needs it, and it eases the CPU/memory load. */ - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + ambiup_free(&device->AmbiUp); } else { @@ -1274,8 +1267,7 @@ no_hrtf: device->Render_Mode = StereoPair; - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + ambiup_free(&device->AmbiUp); bs2blevel = ((headphones && hrtf_appreq != Hrtf_Disable) || (hrtf_appreq == Hrtf_Enable)) ? 5 : 0; |