Skip to content

Commit

Permalink
Fixed unitialized Fingerprints bug (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTyson authored Jul 12, 2024
1 parent 7d077b2 commit 3c0fd15
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/binaryfusefilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ static inline bool binary_fuse8_allocate(uint32_t size,
filter->ArrayLength =
(filter->SegmentCount + arity - 1) * filter->SegmentLength;
filter->SegmentCountLength = filter->SegmentCount * filter->SegmentLength;
filter->Fingerprints = (uint8_t*)malloc(filter->ArrayLength);
filter->Fingerprints =
(uint8_t *)calloc(filter->ArrayLength, sizeof(uint8_t));
return filter->Fingerprints != NULL;
}

Expand Down Expand Up @@ -530,7 +531,8 @@ static inline bool binary_fuse16_allocate(uint32_t size,
filter->ArrayLength =
(filter->SegmentCount + arity - 1) * filter->SegmentLength;
filter->SegmentCountLength = filter->SegmentCount * filter->SegmentLength;
filter->Fingerprints = (uint16_t*)malloc(filter->ArrayLength * sizeof(uint16_t));
filter->Fingerprints =
(uint16_t *)calloc(filter->ArrayLength, sizeof(uint16_t));
return filter->Fingerprints != NULL;
}

Expand Down

0 comments on commit 3c0fd15

Please sign in to comment.