summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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