Fix memory-leak in OpaqueVal.

Addresses #986.
This commit is contained in:
Matthias Vallentin 2013-05-03 14:26:02 -07:00
parent 9a319a995e
commit e78c20c0f8
2 changed files with 5 additions and 1 deletions

View file

@ -3125,12 +3125,13 @@ void VectorVal::ValDescribe(ODesc* d) const
d->Add("]"); d->Add("]");
} }
OpaqueVal::OpaqueVal(OpaqueType* t) : Val(t) OpaqueVal::OpaqueVal(OpaqueType* t) : Val(t), type(t)
{ {
} }
OpaqueVal::~OpaqueVal() OpaqueVal::~OpaqueVal()
{ {
Unref(type);
} }
IMPLEMENT_SERIAL(OpaqueVal, SER_OPAQUE_VAL); IMPLEMENT_SERIAL(OpaqueVal, SER_OPAQUE_VAL);

View file

@ -1024,6 +1024,9 @@ protected:
OpaqueVal() { } OpaqueVal() { }
DECLARE_SERIAL(OpaqueVal); DECLARE_SERIAL(OpaqueVal);
private:
OpaqueType* type;
}; };
// Checks the given value for consistency with the given type. If an // Checks the given value for consistency with the given type. If an