mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 17:48:21 +00:00
Merge remote-tracking branch 'origin/topic/johanna/stats_smb_leak'
BIT-1534 #merged * origin/topic/johanna/stats_smb_leak: Fix memory leaks in stats.cc and smb.cc
This commit is contained in:
commit
124531d4ae
6 changed files with 34 additions and 8 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
2.4-280 | 2016-02-13 10:40:16 -0800
|
||||||
|
|
||||||
|
* Fix memory leaks in stats.cc and smb.cc. (Johanna Amann)
|
||||||
|
|
||||||
2.4-278 | 2016-02-12 18:53:35 -0800
|
2.4-278 | 2016-02-12 18:53:35 -0800
|
||||||
|
|
||||||
* Better multi-space separator handline. (Mark Taylor & Johanna Amann)
|
* Better multi-space separator handline. (Mark Taylor & Johanna Amann)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.4-278
|
2.4-280
|
||||||
|
|
|
@ -362,12 +362,16 @@ SampleLogger::~SampleLogger()
|
||||||
|
|
||||||
void SampleLogger::FunctionSeen(const Func* func)
|
void SampleLogger::FunctionSeen(const Func* func)
|
||||||
{
|
{
|
||||||
load_samples->Assign(new StringVal(func->Name()), 0);
|
Val* idx = new StringVal(func->Name());
|
||||||
|
load_samples->Assign(idx, 0);
|
||||||
|
Unref(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SampleLogger::LocationSeen(const Location* loc)
|
void SampleLogger::LocationSeen(const Location* loc)
|
||||||
{
|
{
|
||||||
load_samples->Assign(new StringVal(loc->filename), 0);
|
Val* idx = new StringVal(loc->filename);
|
||||||
|
load_samples->Assign(idx, 0);
|
||||||
|
Unref(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SampleLogger::SegmentProfile(const char* /* name */,
|
void SampleLogger::SegmentProfile(const char* /* name */,
|
||||||
|
|
|
@ -753,10 +753,11 @@ public:
|
||||||
TableVal(TableType* t, Attributes* attrs = 0);
|
TableVal(TableType* t, Attributes* attrs = 0);
|
||||||
~TableVal();
|
~TableVal();
|
||||||
|
|
||||||
// Returns true if the assignment typechecked, false if not.
|
// Returns true if the assignment typechecked, false if not. The
|
||||||
// Second version takes a HashKey and Unref()'s it when done.
|
// methods take ownership of new_val, but not of the index. Second
|
||||||
// If we're a set, new_val has to be nil.
|
// version takes a HashKey and Unref()'s it when done. If we're a
|
||||||
// If we aren't a set, index may be nil in the second version.
|
// set, new_val has to be nil. If we aren't a set, index may be nil
|
||||||
|
// in the second version.
|
||||||
int Assign(Val* index, Val* new_val, Opcode op = OP_ASSIGN);
|
int Assign(Val* index, Val* new_val, Opcode op = OP_ASSIGN);
|
||||||
int Assign(Val* index, HashKey* k, Val* new_val, Opcode op = OP_ASSIGN);
|
int Assign(Val* index, HashKey* k, Val* new_val, Opcode op = OP_ASSIGN);
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,9 @@ int SMB_Session::ParseNegotiate(binpac::SMB::SMB_header const& hdr,
|
||||||
{
|
{
|
||||||
binpac::SMB::SMB_dialect* d = (*msg.dialects())[i];
|
binpac::SMB::SMB_dialect* d = (*msg.dialects())[i];
|
||||||
BroString* tmp = ExtractString(d->dialectname());
|
BroString* tmp = ExtractString(d->dialectname());
|
||||||
t->Assign(new Val(i, TYPE_COUNT), new StringVal(tmp));
|
Val* idx = new Val(i, TYPE_COUNT);
|
||||||
|
t->Assign(idx, new StringVal(tmp));
|
||||||
|
Unref(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
val_list* vl = new val_list;
|
val_list* vl = new val_list;
|
||||||
|
|
15
testing/btest/core/leaks/stats.bro
Normal file
15
testing/btest/core/leaks/stats.bro
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
# Needs perftools support.
|
||||||
|
#
|
||||||
|
# @TEST-GROUP: leaks
|
||||||
|
#
|
||||||
|
# @TEST-REQUIRES: bro --help 2>&1 | grep -q mem-leaks
|
||||||
|
#
|
||||||
|
# @TEST-EXEC: HEAP_CHECK_DUMP_DIRECTORY=. HEAPCHECK=local btest-bg-run bro bro -m -r $TRACES/wikipedia.trace %INPUT
|
||||||
|
# @TEST-EXEC: btest-bg-wait 60
|
||||||
|
|
||||||
|
@load policy/misc/stats.bro
|
||||||
|
|
||||||
|
event load_sample(samples: load_sample_info, CPU: interval, dmem: int)
|
||||||
|
{
|
||||||
|
print CPU;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue