Skip to content

Commit

Permalink
Fix potential memory leak in BloomFilterWrapper (#833)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3cur3 authored Feb 16, 2021
1 parent dcace65 commit 9639784
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Core/BloomFilterWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@interface BloomFilterWrapper : NSObject
- (instancetype)initFromPath:(NSString*)path withBitCount:(int)bitCount andTotalItems:(int)totalItems;
- (instancetype)initWithTotalItems:(int)count errorRate:(double)errorRate;
- (void)dealloc;
- (void)add:(NSString*) entry;
- (BOOL)contains:(NSString*) entry;
@end
4 changes: 4 additions & 0 deletions Core/BloomFilterWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ - (instancetype)initWithTotalItems:(int)count errorRate:(double)errorRate {
return self;
}

- (void)dealloc {
delete filter;
}

- (void)add:(NSString*)entry {
if (filter != nil) {
filter->add([entry UTF8String]);
Expand Down

0 comments on commit 9639784

Please sign in to comment.