mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Scope: lookup_ID() and install_ID() return IntrusivePtr<ID>
This fixes several memory leaks and double free bugs.
This commit is contained in:
parent
cbb6f09726
commit
528cf11a5c
14 changed files with 60 additions and 100 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "RuleCondition.h"
|
||||
#include "BroString.h"
|
||||
#include "ID.h"
|
||||
#include "IntrusivePtr.h"
|
||||
#include "IntSet.h"
|
||||
#include "IP.h"
|
||||
#include "analyzer/Analyzer.h"
|
||||
|
@ -1268,17 +1269,14 @@ void RuleMatcher::DumpStateStats(BroFile* f, RuleHdrTest* hdr_test)
|
|||
|
||||
static Val* get_bro_val(const char* label)
|
||||
{
|
||||
ID* id = lookup_ID(label, GLOBAL_MODULE_NAME, false);
|
||||
auto id = lookup_ID(label, GLOBAL_MODULE_NAME, false);
|
||||
if ( ! id )
|
||||
{
|
||||
rules_error("unknown script-level identifier", label);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Val* rval = id->ID_Val();
|
||||
Unref(id);
|
||||
|
||||
return rval;
|
||||
return id->ID_Val();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue