From e5625a21b62f11c7eccc0808a77766b50d973ea4 Mon Sep 17 00:00:00 2001 From: John Glover Date: Wed, 1 Dec 2010 19:52:02 +0000 Subject: Fixed some memory management problems in the SMS analysis process --- sms/sms.i | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sms/sms.i') diff --git a/sms/sms.i b/sms/sms.i index d33c280..ad3fa29 100644 --- a/sms/sms.i +++ b/sms/sms.i @@ -373,7 +373,7 @@ { SMS_SpectralPeaks *s = (SMS_SpectralPeaks *)malloc(sizeof(SMS_SpectralPeaks)); s->nPeaks = n; - if((s->pSpectralPeaks = (SMS_Peak *)calloc (s->nPeaks, sizeof(SMS_Peak))) == NULL) + if((s->pSpectralPeaks = (SMS_Peak *)malloc(n * sizeof(SMS_Peak))) == NULL) { sms_error("could not allocate memory for spectral peaks"); return NULL; @@ -392,7 +392,7 @@ for(i = 0; i < $self->nPeaksFound; i++) pArray[i] = $self->pSpectralPeaks[i].fFreq; } - void getMag( int sizeArray, sfloat *pArray ) + void getMag(int sizeArray, sfloat *pArray ) { if(sizeArray < $self->nPeaksFound) { @@ -403,7 +403,7 @@ for(i = 0; i < $self->nPeaksFound; i++) pArray[i] = $self->pSpectralPeaks[i].fMag; } - void getPhase( int sizeArray, sfloat *pArray ) + void getPhase(int sizeArray, sfloat *pArray ) { if(sizeArray < $self->nPeaksFound) { -- cgit v1.2.3