Skip to content

Commit 11c1060

Browse files
committed
fixed malloc not zero data
1 parent ceda5bf commit 11c1060

File tree

4 files changed

+4
-1
lines changed

4 files changed

+4
-1
lines changed

sz/src/TightDataPointStorageD.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ void new_TightDataPointStorageD(TightDataPointStorageD **this,
168168
{
169169
//int i = 0;
170170
*this = (TightDataPointStorageD *)malloc(sizeof(TightDataPointStorageD));
171+
memset(*this, 0, sizeof(TightDataPointStorageD));
171172
(*this)->allSameData = 0;
172173
(*this)->realPrecision = realPrecision;
173174
(*this)->medianValue = medianValue;

sz/src/TightDataPointStorageF.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ void new_TightDataPointStorageF(TightDataPointStorageF **this,
166166
unsigned char radExpo) {
167167

168168
*this = (TightDataPointStorageF *)malloc(sizeof(TightDataPointStorageF));
169+
memset(*this, 0, sizeof(TightDataPointStorageF));
169170
(*this)->allSameData = 0;
170171
(*this)->realPrecision = realPrecision;
171172
(*this)->medianValue = medianValue;

sz/src/sz_double.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ size_t dataLength, double realPrecision, size_t *outSize, double valueRangeSize,
270270
void SZ_compress_args_double_withinRange(unsigned char* newByteData, double *oriData, size_t dataLength, size_t *outSize)
271271
{
272272
TightDataPointStorageD* tdps = (TightDataPointStorageD*) malloc(sizeof(TightDataPointStorageD));
273+
memset(tdps, 0, sizeof(TightDataPointStorageD));
273274
tdps->leadNumArray = NULL;
274275
tdps->residualMidBits = NULL;
275276

sz/src/sz_float.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ bool SZ_compress_args_float_NoCkRngeNoGzip_1D( unsigned char* newByteData, float
261261
{
262262
return false;
263263
}
264-
265264
free_TightDataPointStorageF(tdps);
266265
return true;
267266
}
@@ -270,6 +269,7 @@ bool SZ_compress_args_float_NoCkRngeNoGzip_1D( unsigned char* newByteData, float
270269
void SZ_compress_args_float_withinRange(unsigned char* newByteData, float *oriData, size_t dataLength, size_t *outSize)
271270
{
272271
TightDataPointStorageF* tdps = (TightDataPointStorageF*) malloc(sizeof(TightDataPointStorageF));
272+
memset(tdps, 0, sizeof(TightDataPointStorageF));
273273
tdps->leadNumArray = NULL;
274274
tdps->residualMidBits = NULL;
275275

0 commit comments

Comments
 (0)