mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 16:48:19 +00:00
Making valgrind a bit more happy, and adding code that may or may not
help with #490 and #491.
This commit is contained in:
parent
1d20d2a985
commit
5113b100d9
5 changed files with 13 additions and 2 deletions
|
@ -1028,7 +1028,7 @@ Contents_DNS::Contents_DNS(Connection* conn, bool orig,
|
||||||
|
|
||||||
Contents_DNS::~Contents_DNS()
|
Contents_DNS::~Contents_DNS()
|
||||||
{
|
{
|
||||||
delete msg_buf;
|
free(msg_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Contents_DNS::Flush()
|
void Contents_DNS::Flush()
|
||||||
|
|
|
@ -1039,6 +1039,11 @@ LogVal* LogMgr::ValToLogVal(Val* val, BroType* ty)
|
||||||
case TYPE_TABLE:
|
case TYPE_TABLE:
|
||||||
{
|
{
|
||||||
ListVal* set = val->AsTableVal()->ConvertToPureList();
|
ListVal* set = val->AsTableVal()->ConvertToPureList();
|
||||||
|
if ( ! set )
|
||||||
|
// ConvertToPureList has reported an internal warning
|
||||||
|
// already. Just keep going by making something up.
|
||||||
|
set = new ListVal(TYPE_INT);
|
||||||
|
|
||||||
lval->val.set_val.size = set->Length();
|
lval->val.set_val.size = set->Length();
|
||||||
lval->val.set_val.vals = new LogVal* [lval->val.set_val.size];
|
lval->val.set_val.vals = new LogVal* [lval->val.set_val.size];
|
||||||
|
|
||||||
|
|
|
@ -2284,7 +2284,10 @@ ListVal* TableVal::ConvertToPureList() const
|
||||||
{
|
{
|
||||||
type_list* tl = table_type->Indices()->Types();
|
type_list* tl = table_type->Indices()->Types();
|
||||||
if ( tl->length() != 1 )
|
if ( tl->length() != 1 )
|
||||||
|
{
|
||||||
InternalWarning("bad index type in TableVal::ConvertToPureList");
|
InternalWarning("bad index type in TableVal::ConvertToPureList");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return ConvertToList((*tl)[0]->Tag());
|
return ConvertToList((*tl)[0]->Tag());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1827,7 +1827,9 @@ BroString* convert_index_to_string(Val* index)
|
||||||
{
|
{
|
||||||
ODesc d;
|
ODesc d;
|
||||||
index->Describe(&d);
|
index->Describe(&d);
|
||||||
return new BroString(1, d.TakeBytes(), d.Len());
|
BroString* s = new BroString(1, d.TakeBytes(), d.Len());
|
||||||
|
s->SetUseFreeToDelete(1);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
%%}
|
%%}
|
||||||
|
|
||||||
|
|
|
@ -1133,6 +1133,7 @@ uint64 calculate_unique_id()
|
||||||
int rnd;
|
int rnd;
|
||||||
} unique;
|
} unique;
|
||||||
|
|
||||||
|
memset(&unique, 0, sizeof(unique)); // Make valgrind happy.
|
||||||
gethostname(unique.hostname, 128);
|
gethostname(unique.hostname, 128);
|
||||||
unique.hostname[sizeof(unique.hostname)-1] = '\0';
|
unique.hostname[sizeof(unique.hostname)-1] = '\0';
|
||||||
gettimeofday(&unique.time, 0);
|
gettimeofday(&unique.time, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue