summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-05-03 08:48:15 -0400
committerEliot Horowitz <eliot@10gen.com>2010-05-03 08:48:15 -0400
commitf68e9e023513d01e3c088e015047b6daec62f228 (patch)
tree395f016525bf4fed2cce266ead2ebfa65961c274
parentaff81e633ec93bdd0c726a17bb6b24bbb280d70f (diff)
downloadmongo-f68e9e023513d01e3c088e015047b6daec62f228.tar.gz
fix ScopedDBCOnnectionleak SERVER-1077
-rw-r--r--client/connpool.cpp8
-rw-r--r--client/connpool.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/client/connpool.cpp b/client/connpool.cpp
index d81f26a8295..1e66292a00e 100644
--- a/client/connpool.cpp
+++ b/client/connpool.cpp
@@ -137,9 +137,11 @@ namespace mongo {
}
ScopedDbConnection::~ScopedDbConnection() {
- if ( _conn && ! _conn->isFailed() ) {
- /* see done() comments above for why we log this line */
- log() << "~ScopedDBConnection: _conn != null" << endl;
+ if ( _conn ){
+ if ( ! _conn->isFailed() ) {
+ /* see done() comments above for why we log this line */
+ log() << "~ScopedDBConnection: _conn != null" << endl;
+ }
kill();
}
}
diff --git a/client/connpool.h b/client/connpool.h
index f39fc8da8ae..6bdd81a531b 100644
--- a/client/connpool.h
+++ b/client/connpool.h
@@ -65,8 +65,10 @@ namespace mongo {
void flush();
DBClientBase *get(const string& host);
void release(const string& host, DBClientBase *c) {
- if ( c->isFailed() )
+ if ( c->isFailed() ){
+ delete c;
return;
+ }
scoped_lock L(_mutex);
_pools[host]->pool.push(c);
}