From 517bae577def7a68669711682a51b5cf0dbe0302 Mon Sep 17 00:00:00 2001 From: liam-strand Date: Wed, 22 Nov 2023 11:48:40 -0600 Subject: [PATCH 1/2] set structure pointers to null after destroying --- examples/src/ambi_dec/ambi_dec.c | 1 + examples/src/ambi_drc/ambi_drc.c | 1 + examples/src/ambi_enc/ambi_enc.c | 1 + examples/src/ambi_roomsim/ambi_roomsim.c | 1 + examples/src/array2sh/array2sh.c | 1 + examples/src/beamformer/beamformer.c | 1 + examples/src/binauraliser/binauraliser.c | 1 + examples/src/binauraliser_nf/binauraliser_nf.c | 1 + examples/src/dirass/dirass.c | 1 + examples/src/matrixconv/matrixconv.c | 1 + examples/src/multiconv/multiconv.c | 1 + examples/src/panner/panner.c | 1 + examples/src/pitch_shifter/pitch_shifter.c | 1 + examples/src/powermap/powermap.c | 1 + examples/src/sldoa/sldoa.c | 1 + examples/src/spreader/spreader.c | 1 + examples/src/tvconv/tvconv.c | 1 + framework/modules/saf_tracker/saf_tracker.c | 1 + 18 files changed, 18 insertions(+) diff --git a/examples/src/ambi_dec/ambi_dec.c b/examples/src/ambi_dec/ambi_dec.c index a1163522d..bc3987bde 100644 --- a/examples/src/ambi_dec/ambi_dec.c +++ b/examples/src/ambi_dec/ambi_dec.c @@ -162,6 +162,7 @@ void ambi_dec_destroy free(pData->progressBarText); free(pData); pData = NULL; + *phAmbi = NULL; } } diff --git a/examples/src/ambi_drc/ambi_drc.c b/examples/src/ambi_drc/ambi_drc.c index c2c77c890..2f042db3e 100644 --- a/examples/src/ambi_drc/ambi_drc.c +++ b/examples/src/ambi_drc/ambi_drc.c @@ -98,6 +98,7 @@ void ambi_drc_destroy #endif free(pData); pData = NULL; + *phAmbi = NULL; } } diff --git a/examples/src/ambi_enc/ambi_enc.c b/examples/src/ambi_enc/ambi_enc.c index e4b996d50..536f3a4db 100644 --- a/examples/src/ambi_enc/ambi_enc.c +++ b/examples/src/ambi_enc/ambi_enc.c @@ -60,6 +60,7 @@ void ambi_enc_destroy if (pData != NULL) { free(pData); pData = NULL; + *phAmbi = NULL; } } diff --git a/examples/src/ambi_roomsim/ambi_roomsim.c b/examples/src/ambi_roomsim/ambi_roomsim.c index 31fc392d5..8ef5eda8d 100644 --- a/examples/src/ambi_roomsim/ambi_roomsim.c +++ b/examples/src/ambi_roomsim/ambi_roomsim.c @@ -88,6 +88,7 @@ void ambi_roomsim_destroy free(pData->rec_sh_outsigs); free(pData); pData = NULL; + *phAmbi = NULL; } } diff --git a/examples/src/array2sh/array2sh.c b/examples/src/array2sh/array2sh.c index 877573862..6e3e1273b 100644 --- a/examples/src/array2sh/array2sh.c +++ b/examples/src/array2sh/array2sh.c @@ -126,6 +126,7 @@ void array2sh_destroy free(pData); pData = NULL; + *phM2sh = NULL; } } diff --git a/examples/src/beamformer/beamformer.c b/examples/src/beamformer/beamformer.c index 66e5de4b8..2a8d2a199 100644 --- a/examples/src/beamformer/beamformer.c +++ b/examples/src/beamformer/beamformer.c @@ -64,6 +64,7 @@ void beamformer_destroy free(pData); pData = NULL; + *phBeam = NULL; } } diff --git a/examples/src/binauraliser/binauraliser.c b/examples/src/binauraliser/binauraliser.c index dc4ea3977..5ac011d7e 100644 --- a/examples/src/binauraliser/binauraliser.c +++ b/examples/src/binauraliser/binauraliser.c @@ -129,6 +129,7 @@ void binauraliser_destroy free(pData); pData = NULL; + *phBin = NULL; } } diff --git a/examples/src/binauraliser_nf/binauraliser_nf.c b/examples/src/binauraliser_nf/binauraliser_nf.c index d42d4b045..119423a0a 100644 --- a/examples/src/binauraliser_nf/binauraliser_nf.c +++ b/examples/src/binauraliser_nf/binauraliser_nf.c @@ -167,6 +167,7 @@ void binauraliserNF_destroy free(pData); pData = NULL; + *phBin = NULL; } } diff --git a/examples/src/dirass/dirass.c b/examples/src/dirass/dirass.c index 878784860..144790367 100644 --- a/examples/src/dirass/dirass.c +++ b/examples/src/dirass/dirass.c @@ -139,6 +139,7 @@ void dirass_destroy free(pData->progressBarText); free(pData); pData = NULL; + *phDir = NULL; } } diff --git a/examples/src/matrixconv/matrixconv.c b/examples/src/matrixconv/matrixconv.c index ad119e33d..d42fa6816 100644 --- a/examples/src/matrixconv/matrixconv.c +++ b/examples/src/matrixconv/matrixconv.c @@ -70,6 +70,7 @@ void matrixconv_destroy saf_matrixConv_destroy(&(pData->hMatrixConv)); free(pData); pData = NULL; + *phMCnv = NULL; } } diff --git a/examples/src/multiconv/multiconv.c b/examples/src/multiconv/multiconv.c index 568bde837..889bf9c5d 100644 --- a/examples/src/multiconv/multiconv.c +++ b/examples/src/multiconv/multiconv.c @@ -68,6 +68,7 @@ void multiconv_destroy saf_multiConv_destroy(&(pData->hMultiConv)); free(pData); pData = NULL; + *phMCnv = NULL; } } diff --git a/examples/src/panner/panner.c b/examples/src/panner/panner.c index 9685fc3b7..be443a772 100644 --- a/examples/src/panner/panner.c +++ b/examples/src/panner/panner.c @@ -112,6 +112,7 @@ void panner_destroy free(pData); pData = NULL; + *phPan = NULL; } } diff --git a/examples/src/pitch_shifter/pitch_shifter.c b/examples/src/pitch_shifter/pitch_shifter.c index 95347d892..564dfb4f5 100644 --- a/examples/src/pitch_shifter/pitch_shifter.c +++ b/examples/src/pitch_shifter/pitch_shifter.c @@ -77,6 +77,7 @@ void pitch_shifter_destroy smb_pitchShift_destroy(&(pData->hSmb)); free(pData); pData = NULL; + *phPS = NULL; } } diff --git a/examples/src/powermap/powermap.c b/examples/src/powermap/powermap.c index 43e27223a..289eb2a39 100644 --- a/examples/src/powermap/powermap.c +++ b/examples/src/powermap/powermap.c @@ -128,6 +128,7 @@ void powermap_destroy free(pData->progressBarText); free(pData); pData = NULL; + *phPm = NULL; } } diff --git a/examples/src/sldoa/sldoa.c b/examples/src/sldoa/sldoa.c index f92e459e9..4547ff502 100644 --- a/examples/src/sldoa/sldoa.c +++ b/examples/src/sldoa/sldoa.c @@ -133,6 +133,7 @@ void sldoa_destroy free(pData->progressBarText); free(pData); pData = NULL; + *phSld = NULL; } } diff --git a/examples/src/spreader/spreader.c b/examples/src/spreader/spreader.c index a7041a466..c178e2ee1 100644 --- a/examples/src/spreader/spreader.c +++ b/examples/src/spreader/spreader.c @@ -168,6 +168,7 @@ void spreader_destroy free(pData); pData = NULL; + *phSpr = NULL; } } diff --git a/examples/src/tvconv/tvconv.c b/examples/src/tvconv/tvconv.c index 23992f63a..9d11a7ac8 100644 --- a/examples/src/tvconv/tvconv.c +++ b/examples/src/tvconv/tvconv.c @@ -94,6 +94,7 @@ void tvconv_destroy saf_TVConv_destroy(&(pData->hTVConv)); free(pData); pData = NULL; + *phTVCnv = NULL; } } diff --git a/framework/modules/saf_tracker/saf_tracker.c b/framework/modules/saf_tracker/saf_tracker.c index e34286f2f..289f16aed 100644 --- a/framework/modules/saf_tracker/saf_tracker.c +++ b/framework/modules/saf_tracker/saf_tracker.c @@ -147,6 +147,7 @@ void tracker3d_destroy free(pData); pData = NULL; + *phT3d = NULL; } } From 3e891d5eebd529ad94999f92b66a42f45dd56e07 Mon Sep 17 00:00:00 2001 From: liam-strand Date: Wed, 22 Nov 2023 12:09:56 -0600 Subject: [PATCH 2/2] set structure handle to NULL for a few more utilities --- framework/modules/saf_cdf4sap/saf_cdf4sap.c | 2 ++ framework/modules/saf_utilities/saf_utility_fft.c | 6 ++++-- framework/modules/saf_utilities/saf_utility_matrixConv.c | 9 ++++++--- framework/modules/saf_utilities/saf_utility_pitch.c | 3 ++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/framework/modules/saf_cdf4sap/saf_cdf4sap.c b/framework/modules/saf_cdf4sap/saf_cdf4sap.c index 7636fccec..2c76002d4 100644 --- a/framework/modules/saf_cdf4sap/saf_cdf4sap.c +++ b/framework/modules/saf_cdf4sap/saf_cdf4sap.c @@ -226,6 +226,7 @@ void cdf4sap_destroy free(h->G_M); free(h); h = NULL; + *phCdf = NULL; } } @@ -264,6 +265,7 @@ void cdf4sap_cmplx_destroy free(h->G_M); free(h); h = NULL; + *phCdf = NULL; } } diff --git a/framework/modules/saf_utilities/saf_utility_fft.c b/framework/modules/saf_utilities/saf_utility_fft.c index ae7336991..f40ad0b4e 100644 --- a/framework/modules/saf_utilities/saf_utility_fft.c +++ b/framework/modules/saf_utilities/saf_utility_fft.c @@ -661,7 +661,8 @@ void saf_rfft_destroy } free(h); - h=NULL; + h = NULL; + *phFFT = NULL; } } @@ -888,7 +889,8 @@ void saf_fft_destroy } free(h); - h=NULL; + h = NULL; + *phFFT = NULL; } } diff --git a/framework/modules/saf_utilities/saf_utility_matrixConv.c b/framework/modules/saf_utilities/saf_utility_matrixConv.c index f53d203c5..1ab3856a9 100644 --- a/framework/modules/saf_utilities/saf_utility_matrixConv.c +++ b/framework/modules/saf_utilities/saf_utility_matrixConv.c @@ -156,7 +156,8 @@ void saf_matrixConv_destroy free(h->Hpart_f); } free(h); - h=NULL; + h = NULL; + *phMC = NULL; } } @@ -363,7 +364,8 @@ void saf_multiConv_destroy free(h->Hpart_f); } free(h); - h=NULL; + h = NULL; + *phMC = NULL; } } @@ -568,7 +570,8 @@ void saf_TVConv_destroy free(h->Hpart_f); } free(h); - h=NULL; + h = NULL; + *phTVC = NULL; } void saf_TVConv_apply diff --git a/framework/modules/saf_utilities/saf_utility_pitch.c b/framework/modules/saf_utilities/saf_utility_pitch.c index ceab08288..a8df005a2 100644 --- a/framework/modules/saf_utilities/saf_utility_pitch.c +++ b/framework/modules/saf_utilities/saf_utility_pitch.c @@ -192,7 +192,8 @@ void smb_pitchShift_destroy free(h->gSynFreq); free(h->gSynMagn); free(h); - h=NULL; + h = NULL; + *hSmb = NULL; } }