From 6634a2a0a761b9969578f8e206110cf0da545887 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 17 Dec 2015 16:24:16 -0800 Subject: [PATCH] Don't forget to pthread_mutex_destroy() This was a bit of an unfortunate omission. It meant we were leaking our mutexes. Oops. --- PMKVObserver/KVObserver.m | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PMKVObserver/KVObserver.m b/PMKVObserver/KVObserver.m index b34227b..b05b360 100644 --- a/PMKVObserver/KVObserver.m +++ b/PMKVObserver/KVObserver.m @@ -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]; }