Skip to content

Commit

Permalink
Don't forget to pthread_mutex_destroy()
Browse files Browse the repository at this point in the history
This was a bit of an unfortunate omission. It meant we were leaking our
mutexes. Oops.
  • Loading branch information
Kevin Ballard committed Dec 18, 2015
1 parent 4499064 commit 6634a2a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PMKVObserver/KVObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ - (instancetype)init {
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"-[PMKVObserver init] is not available" userInfo:nil];
}

- (void)dealloc {
int retval = pthread_mutex_destroy(&_mutex);
if (__builtin_expect(retval, 0) != 0) {
NSLog(@"PMKVObserver: pthread_mutex_destroy: %s", strerror(retval));
}
}

- (void)cancel {
[self cancel:NO];
}
Expand Down

0 comments on commit 6634a2a

Please sign in to comment.