summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-09-22 19:22:27 -0400
committerEliot Horowitz <eliot@10gen.com>2010-10-26 15:51:25 -0400
commit4f5c02f8d92ff213b71b88f5eb643b7f62b50abc (patch)
tree96fadbf9d7dfb19a01c24300b20c93dd6a19f6aa
parent0737ad69095b8d0d036805705f989f76ca81bc86 (diff)
downloadmongo-r1.6.4.tar.gz
Plug memory leak SERVER-1827r1.6.4
-rw-r--r--db/query.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/db/query.cpp b/db/query.cpp
index 5bd7b00ac2a..1cbf97d4be9 100644
--- a/db/query.cpp
+++ b/db/query.cpp
@@ -787,8 +787,10 @@ namespace mongo {
if ( _pq.isExplain()) {
_eb.noteScan( _c.get(), _nscanned, _nscannedObjects, _n, scanAndOrderRequired(), _curop.elapsedMillis(), useHints && !_pq.getHint().eoo() );
} else {
- _response.appendData( _buf.buf(), _buf.len() );
- _buf.decouple();
+ if (_buf.len()) {
+ _response.appendData( _buf.buf(), _buf.len() );
+ _buf.decouple();
+ }
}
if ( stop ) {
setStop();