summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-05-03 15:03:18 -0400
committerEliot Horowitz <eliot@10gen.com>2010-05-03 15:03:18 -0400
commitc76768d3e8e34e781f30e40427259ffe0a1f8176 (patch)
tree3ef0cf75cd2a8398c7a91a2b6074e9f31e4f8ce2
parente9ef03782ca0b5f8d979a9c439d49c6ab8b540ce (diff)
downloadmongo-c76768d3e8e34e781f30e40427259ffe0a1f8176.tar.gz
fix ScopedDBCOnnectionleak SERVER-1077
Conflicts: client/connpool.h
-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 d69c78741f3..5a084831216 100644
--- a/client/connpool.cpp
+++ b/client/connpool.cpp
@@ -115,9 +115,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 5a47b01b798..b44ff518fd7 100644
--- a/client/connpool.h
+++ b/client/connpool.h
@@ -61,8 +61,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(poolMutex);
pools[host]->pool.push(c);
}