Fix memory leak in HashVal subclass ctors.

The instantiation of OpaqueType here is ref'd by the Val ctor, which
has a corresponding deref in the Val dtor, but a deref is still needed
for the instantiation itself.
This commit is contained in:
Jon Siwek 2013-03-27 16:22:23 -05:00
parent 7caa4aa45c
commit f5d8ed299d

View file

@ -36,7 +36,7 @@ public:
u_char key[MD5_DIGEST_LENGTH],
u_char result[MD5_DIGEST_LENGTH]);
MD5Val() : HashVal(new OpaqueType("md5")) { }
MD5Val() : HashVal(new OpaqueType("md5")) { Unref(Type()); }
protected:
friend class Val;
@ -55,7 +55,7 @@ class SHA1Val : public HashVal {
public:
static void digest(val_list& vlist, u_char result[SHA_DIGEST_LENGTH]);
SHA1Val() : HashVal(new OpaqueType("sha1")) { }
SHA1Val() : HashVal(new OpaqueType("sha1")) { Unref(Type()); }
protected:
friend class Val;
@ -74,7 +74,7 @@ class SHA256Val : public HashVal {
public:
static void digest(val_list& vlist, u_char result[SHA256_DIGEST_LENGTH]);
SHA256Val() : HashVal(new OpaqueType("sha256")) { }
SHA256Val() : HashVal(new OpaqueType("sha256")) { Unref(Type()); }
protected:
friend class Val;