diff options
author | John Glover <glover.john@gmail.com> | 2010-12-08 18:45:14 +0000 |
---|---|---|
committer | John Glover <glover.john@gmail.com> | 2010-12-08 18:45:14 +0000 |
commit | d7eb9bcda3848ce1b3816d428e8dd66d9b0e02d8 (patch) | |
tree | fa51471e087d8d116bffb4969a4c1b14b0438cfe /sms/sms.i | |
parent | 2a7cc2153f7445453422d74d87d2ce0cf9de51ff (diff) | |
download | simpl-d7eb9bcda3848ce1b3816d428e8dd66d9b0e02d8.tar.gz simpl-d7eb9bcda3848ce1b3816d428e8dd66d9b0e02d8.tar.bz2 simpl-d7eb9bcda3848ce1b3816d428e8dd66d9b0e02d8.zip |
SMSPeakDetection bug fixes
Diffstat (limited to 'sms/sms.i')
-rw-r--r-- | sms/sms.i | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -372,13 +372,16 @@ SMS_SpectralPeaks(int n) { SMS_SpectralPeaks *s = (SMS_SpectralPeaks *)malloc(sizeof(SMS_SpectralPeaks)); - s->nPeaks = n; - if((s->pSpectralPeaks = (SMS_Peak *)malloc(n * sizeof(SMS_Peak))) == NULL) + if(s == NULL) { - sms_error("could not allocate memory for spectral peaks"); + sms_error("Could not allocate memory for SMS_SpectralPeaks"); + return NULL; + } + if(sms_initSpectralPeaks(s, n) < 0) + { + sms_error("Could not initialise SMS_SpectralPeaks"); return NULL; } - s->nPeaksFound = 0; return s; } void getFreq(int sizeArray, sfloat *pArray ) |