Skip to content

Commit

Permalink
Merge pull request #64 from liam-strand/master
Browse files Browse the repository at this point in the history
Always Clear Dereferenced Pointers in `*_destroy` Functions
  • Loading branch information
leomccormack committed Nov 22, 2023
2 parents 7ff2c3d + 3e891d5 commit 1f0ecf2
Show file tree
Hide file tree
Showing 22 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions examples/src/ambi_dec/ambi_dec.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void ambi_dec_destroy
free(pData->progressBarText);
free(pData);
pData = NULL;
*phAmbi = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/ambi_drc/ambi_drc.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void ambi_drc_destroy
#endif
free(pData);
pData = NULL;
*phAmbi = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/ambi_enc/ambi_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void ambi_enc_destroy
if (pData != NULL) {
free(pData);
pData = NULL;
*phAmbi = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/ambi_roomsim/ambi_roomsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void ambi_roomsim_destroy
free(pData->rec_sh_outsigs);
free(pData);
pData = NULL;
*phAmbi = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/array2sh/array2sh.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void array2sh_destroy

free(pData);
pData = NULL;
*phM2sh = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/beamformer/beamformer.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void beamformer_destroy

free(pData);
pData = NULL;
*phBeam = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/binauraliser/binauraliser.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ void binauraliser_destroy

free(pData);
pData = NULL;
*phBin = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/binauraliser_nf/binauraliser_nf.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ void binauraliserNF_destroy

free(pData);
pData = NULL;
*phBin = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/dirass/dirass.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ void dirass_destroy
free(pData->progressBarText);
free(pData);
pData = NULL;
*phDir = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/matrixconv/matrixconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ void matrixconv_destroy
saf_matrixConv_destroy(&(pData->hMatrixConv));
free(pData);
pData = NULL;
*phMCnv = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/multiconv/multiconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ void multiconv_destroy
saf_multiConv_destroy(&(pData->hMultiConv));
free(pData);
pData = NULL;
*phMCnv = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/panner/panner.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void panner_destroy

free(pData);
pData = NULL;
*phPan = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/pitch_shifter/pitch_shifter.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void pitch_shifter_destroy
smb_pitchShift_destroy(&(pData->hSmb));
free(pData);
pData = NULL;
*phPS = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/powermap/powermap.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ void powermap_destroy
free(pData->progressBarText);
free(pData);
pData = NULL;
*phPm = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/sldoa/sldoa.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void sldoa_destroy
free(pData->progressBarText);
free(pData);
pData = NULL;
*phSld = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/spreader/spreader.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ void spreader_destroy

free(pData);
pData = NULL;
*phSpr = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions examples/src/tvconv/tvconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ void tvconv_destroy
saf_TVConv_destroy(&(pData->hTVConv));
free(pData);
pData = NULL;
*phTVCnv = NULL;
}
}

Expand Down
2 changes: 2 additions & 0 deletions framework/modules/saf_cdf4sap/saf_cdf4sap.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ void cdf4sap_destroy
free(h->G_M);
free(h);
h = NULL;
*phCdf = NULL;
}
}

Expand Down Expand Up @@ -264,6 +265,7 @@ void cdf4sap_cmplx_destroy
free(h->G_M);
free(h);
h = NULL;
*phCdf = NULL;
}
}

Expand Down
1 change: 1 addition & 0 deletions framework/modules/saf_tracker/saf_tracker.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void tracker3d_destroy

free(pData);
pData = NULL;
*phT3d = NULL;
}
}

Expand Down
6 changes: 4 additions & 2 deletions framework/modules/saf_utilities/saf_utility_fft.c
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ void saf_rfft_destroy
}

free(h);
h=NULL;
h = NULL;
*phFFT = NULL;
}
}

Expand Down Expand Up @@ -888,7 +889,8 @@ void saf_fft_destroy
}

free(h);
h=NULL;
h = NULL;
*phFFT = NULL;
}
}

Expand Down
9 changes: 6 additions & 3 deletions framework/modules/saf_utilities/saf_utility_matrixConv.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ void saf_matrixConv_destroy
free(h->Hpart_f);
}
free(h);
h=NULL;
h = NULL;
*phMC = NULL;
}
}

Expand Down Expand Up @@ -363,7 +364,8 @@ void saf_multiConv_destroy
free(h->Hpart_f);
}
free(h);
h=NULL;
h = NULL;
*phMC = NULL;
}
}

Expand Down Expand Up @@ -568,7 +570,8 @@ void saf_TVConv_destroy
free(h->Hpart_f);
}
free(h);
h=NULL;
h = NULL;
*phTVC = NULL;
}

void saf_TVConv_apply
Expand Down
3 changes: 2 additions & 1 deletion framework/modules/saf_utilities/saf_utility_pitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ void smb_pitchShift_destroy
free(h->gSynFreq);
free(h->gSynMagn);
free(h);
h=NULL;
h = NULL;
*hSmb = NULL;
}
}

Expand Down

0 comments on commit 1f0ecf2

Please sign in to comment.