mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +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
|
@ -606,7 +606,7 @@ BuiltinFunc::BuiltinFunc(built_in_func arg_func, const char* arg_name,
|
|||
name = make_full_var_name(GLOBAL_MODULE_NAME, arg_name);
|
||||
is_pure = arg_is_pure;
|
||||
|
||||
ID* id = lookup_ID(Name(), GLOBAL_MODULE_NAME, false);
|
||||
auto id = lookup_ID(Name(), GLOBAL_MODULE_NAME, false);
|
||||
if ( ! id )
|
||||
reporter->InternalError("built-in function %s missing", Name());
|
||||
if ( id->HasVal() )
|
||||
|
@ -614,7 +614,6 @@ BuiltinFunc::BuiltinFunc(built_in_func arg_func, const char* arg_name,
|
|||
|
||||
type = id->Type()->Ref();
|
||||
id->SetVal(new Val(this));
|
||||
Unref(id);
|
||||
}
|
||||
|
||||
BuiltinFunc::~BuiltinFunc()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue