fix opaqueval-related memleak

This commit is contained in:
Bernhard Amann 2013-05-03 23:08:26 -07:00
parent 6acbbe0231
commit cf6e768ad6
3 changed files with 6 additions and 2 deletions

View file

@ -243,6 +243,7 @@ OpaqueType* md5_type;
OpaqueType* sha1_type; OpaqueType* sha1_type;
OpaqueType* sha256_type; OpaqueType* sha256_type;
OpaqueType* entropy_type; OpaqueType* entropy_type;
OpaqueType* topk_type;
#include "const.bif.netvar_def" #include "const.bif.netvar_def"
#include "types.bif.netvar_def" #include "types.bif.netvar_def"
@ -308,6 +309,7 @@ void init_general_global_var()
sha1_type = new OpaqueType("sha1"); sha1_type = new OpaqueType("sha1");
sha256_type = new OpaqueType("sha256"); sha256_type = new OpaqueType("sha256");
entropy_type = new OpaqueType("entropy"); entropy_type = new OpaqueType("entropy");
topk_type = new OpaqueType("topk");
} }
void init_net_var() void init_net_var()

View file

@ -248,6 +248,7 @@ extern OpaqueType* md5_type;
extern OpaqueType* sha1_type; extern OpaqueType* sha1_type;
extern OpaqueType* sha256_type; extern OpaqueType* sha256_type;
extern OpaqueType* entropy_type; extern OpaqueType* entropy_type;
extern OpaqueType* topk_type;
// Initializes globals that don't pertain to network/event analysis. // Initializes globals that don't pertain to network/event analysis.
extern void init_general_global_var(); extern void init_general_global_var();

View file

@ -4,6 +4,7 @@
#include "CompHash.h" #include "CompHash.h"
#include "Reporter.h" #include "Reporter.h"
#include "Serializer.h" #include "Serializer.h"
#include "NetVar.h"
namespace Topk { namespace Topk {
@ -36,7 +37,7 @@ HashKey* TopkVal::GetHash(Val* v) const
return key; return key;
} }
TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(new OpaqueType("topk")) TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(topk_type)
{ {
elementDict = new PDict(Element); elementDict = new PDict(Element);
elementDict->SetDeleteFunc(topk_element_hash_delete_func); elementDict->SetDeleteFunc(topk_element_hash_delete_func);
@ -46,7 +47,7 @@ TopkVal::TopkVal(uint64 arg_size) : OpaqueVal(new OpaqueType("topk"))
pruned = false; pruned = false;
} }
TopkVal::TopkVal() : OpaqueVal(new OpaqueType("topk")) TopkVal::TopkVal() : OpaqueVal(topk_type)
{ {
elementDict = new PDict(Element); elementDict = new PDict(Element);
elementDict->SetDeleteFunc(topk_element_hash_delete_func); elementDict->SetDeleteFunc(topk_element_hash_delete_func);