ref: 233c9646efb377aac5b0d87df6f8a16be94fa3fe
parent: 3cc247773294861e50209f6e4f11224dd89112fb
author: Paul Batchelor <[email protected]>
date: Mon Jan 4 11:40:39 EST 2021
ftbl_init: only zero out N samples, not N + 1 samples.
--- a/modules/ftbl.c
+++ b/modules/ftbl.c
@@ -17,7 +17,7 @@
int sp_ftbl_init(sp_data *sp, sp_ftbl *ft, size_t size)
{
ft->size = size;
- memset(ft->tbl, 0, sizeof(SPFLOAT) * (size + 1));
+ memset(ft->tbl, 0, sizeof(SPFLOAT) * size);
return SP_OK;
}
@@ -26,9 +26,7 @@
sp_ftbl *ftp;
*ft = malloc(sizeof(sp_ftbl));
ftp = *ft;
- ftp->tbl = malloc(sizeof(SPFLOAT) * (size + 1));
- memset(ftp->tbl, 0, sizeof(SPFLOAT) * (size + 1));
-
+ ftp->tbl = calloc(1, sizeof(SPFLOAT) * (size + 1));
sp_ftbl_init(sp, ftp, size);
return SP_OK;
}