summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2008-07-17 16:02:32 -0400
committerDwight <dmerriman@gmail.com>2008-07-17 16:02:32 -0400
commit1c54c09a288834822dedd4b42fbc807f3c620240 (patch)
treeeec1f7d4f40284339a83872225fe3272ad0ad412
parentc3adb4946fd99ff8a76fc1abb0fabbbae2254c80 (diff)
downloadmongo-r0.0.8_rc1.tar.gz
mem leak regression from bad git merge fixedr0.0.8_rc1
-rw-r--r--db/jsobj.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/db/jsobj.h b/db/jsobj.h
index c3dc8b8e960..cfdff58f04c 100644
--- a/db/jsobj.h
+++ b/db/jsobj.h
@@ -170,7 +170,14 @@ class JSObj {
friend class JSElemIter;
class Details {
public:
- ~Details() { _objdata = 0; }
+ ~Details() {
+ // note refCount means two different things (thus the assert here)
+ assert(refCount <= 0);
+ if (owned()) {
+ free((void *)_objdata);
+ }
+ _objdata = 0;
+ }
const char *_objdata;
int _objsize;
int refCount; // -1 == don't free