THRIFT: Mutex and ReadWriteMutex leaked memory, now they don't
Summary: also added myself to CONTRIBUTORS.
Reviewed By: marc
Test Plan: the following program no longer leaks memory (valgrind):
int main(int argc, char **argv){
Mutex mu;
mu.lock();
mu.unlock();
}
Revert Plan: ok
Notes: this is kind of important
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665279 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/Mutex.cpp b/lib/cpp/src/concurrency/Mutex.cpp
index 695d5dc..2674d44 100644
--- a/lib/cpp/src/concurrency/Mutex.cpp
+++ b/lib/cpp/src/concurrency/Mutex.cpp
@@ -46,6 +46,8 @@
Mutex::Mutex() : impl_(new Mutex::impl()) {}
+Mutex::~Mutex() { delete impl_; }
+
void Mutex::lock() const { impl_->lock(); }
bool Mutex::trylock() const { return impl_->trylock(); }
@@ -91,6 +93,8 @@
ReadWriteMutex::ReadWriteMutex() : impl_(new ReadWriteMutex::impl()) {}
+ReadWriteMutex::~ReadWriteMutex() { delete impl_; }
+
void ReadWriteMutex::acquireRead() const { impl_->acquireRead(); }
void ReadWriteMutex::acquireWrite() const { impl_->acquireWrite(); }