aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/bformatdec.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-02-12 20:48:28 -0800
committerChris Robinson <[email protected]>2018-02-12 20:48:28 -0800
commit4d417f3dd4c6fee0e5050768a231c65a700ee417 (patch)
tree712c17c72e06d855e88bfa7bd8c4e02c9e0b187c /Alc/bformatdec.c
parentdce497fbca5d3b3b843e4475a94febd9105de87c (diff)
Make bformatdec_free and ambiup_free clear the freed pointer
Diffstat (limited to 'Alc/bformatdec.c')
-rw-r--r--Alc/bformatdec.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/Alc/bformatdec.c b/Alc/bformatdec.c
index 4dbca6a3..5a3726e1 100644
--- a/Alc/bformatdec.c
+++ b/Alc/bformatdec.c
@@ -217,17 +217,17 @@ BFormatDec *bformatdec_alloc()
return al_calloc(16, sizeof(BFormatDec));
}
-void bformatdec_free(BFormatDec *dec)
+void bformatdec_free(BFormatDec **dec)
{
if(dec)
{
- al_free(dec->Samples);
- dec->Samples = NULL;
- dec->SamplesHF = NULL;
- dec->SamplesLF = NULL;
+ al_free((*dec)->Samples);
+ (*dec)->Samples = NULL;
+ (*dec)->SamplesHF = NULL;
+ (*dec)->SamplesLF = NULL;
- memset(dec, 0, sizeof(*dec));
- al_free(dec);
+ al_free(*dec);
+ *dec = NULL;
}
}
@@ -507,9 +507,13 @@ AmbiUpsampler *ambiup_alloc()
return al_calloc(16, sizeof(AmbiUpsampler));
}
-void ambiup_free(struct AmbiUpsampler *ambiup)
+void ambiup_free(struct AmbiUpsampler **ambiup)
{
- al_free(ambiup);
+ if(ambiup)
+ {
+ al_free(*ambiup);
+ *ambiup = NULL;
+ }
}
void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device)