summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGeir Magnusson Jr <geir@pthbbbbbb-2.local>2008-07-15 19:53:13 -0400
committerGeir Magnusson Jr <geir@pthbbbbbb-2.local>2008-07-15 19:53:13 -0400
commitdb271db1910e885e59e4539d2b207253b8486151 (patch)
tree640081b307aa69957c962657d2354958540c539d /db
parent5abe19bb16b8dde6acb9e4e7554969e88abc10fc (diff)
downloadmongo-db271db1910e885e59e4539d2b207253b8486151.tar.gz
jsobj.h : further augment ~Details() - ensure that not only is this buffer owned before freeing, but assert that
we've been properly deferences from all that held our pointed (refCount == 0)
Diffstat (limited to 'db')
-rw-r--r--db/jsobj.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/db/jsobj.h b/db/jsobj.h
index 071a2690a5a..76b97c33b83 100644
--- a/db/jsobj.h
+++ b/db/jsobj.h
@@ -171,7 +171,11 @@ class JSObj {
class Details {
public:
~Details() {
- if (refCount != -1) {
+
+ assert(refCount <= 0);
+
+ // note that the assert above protects owned() from lying to us. If the assert() goes, fix this
+ if (owned()) {
free((void *)_objdata);
}
_objdata = 0;