diff --git a/src/Val.cc b/src/Val.cc index dd86e71a9e..2aafc30ab2 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -3125,12 +3125,13 @@ void VectorVal::ValDescribe(ODesc* d) const d->Add("]"); } -OpaqueVal::OpaqueVal(OpaqueType* t) : Val(t) +OpaqueVal::OpaqueVal(OpaqueType* t) : Val(t), type(t) { } OpaqueVal::~OpaqueVal() { + Unref(type); } IMPLEMENT_SERIAL(OpaqueVal, SER_OPAQUE_VAL); diff --git a/src/Val.h b/src/Val.h index 4b2705c5b4..8544fbadfd 100644 --- a/src/Val.h +++ b/src/Val.h @@ -1024,6 +1024,9 @@ protected: OpaqueVal() { } DECLARE_SERIAL(OpaqueVal); + +private: + OpaqueType* type; }; // Checks the given value for consistency with the given type. If an