mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge branch 'leaks' of https://github.com/MaxKellermann/zeek
Only one instance of base_type() getting a NewRef instead of AdoptRef fixed in merge. All other changes are superficial formatting and factoring. * 'leaks' of https://github.com/MaxKellermann/zeek: (22 commits) Stmt: use class IntrusivePtr Stmt: remove unused default constructors and `friend` declarations Val: remove unimplemented prototype recover_val() Val: cast_value_to_type() returns IntrusivePtr Val: use IntrusivePtr in check_and_promote() Val: use nullptr instead of 0 zeekygen: use class IntrusivePtr ID: use class IntrusivePtr Expr: use class IntrusivePtr Var: copy Location to stack, to fix use-after-free crash bug Scope: lookup_ID() and install_ID() return IntrusivePtr<ID> Scope: delete duplicate locals EventRegistry: automatically delete EventHandlers main: destroy event_registry after iosource_mgr zeekygen/IdentifierInfo: delete duplicate fields main: free the global scope in terminate_bro() Scope: pop_scope() returns IntrusivePtr<> Scope: unref all inits in destructor Var: pass IntrusivePtr to add_global(), add_local() etc. plugin/ComponentManager: hold a reference to the EnumType ...
This commit is contained in:
commit
cf196bb148
41 changed files with 1864 additions and 2095 deletions
18
src/Debug.cc
18
src/Debug.cc
|
@ -16,10 +16,12 @@ using namespace std;
|
|||
#include "DebugCmds.h"
|
||||
#include "DbgBreakpoint.h"
|
||||
#include "ID.h"
|
||||
#include "IntrusivePtr.h"
|
||||
#include "Expr.h"
|
||||
#include "Stmt.h"
|
||||
#include "Frame.h"
|
||||
#include "Func.h"
|
||||
#include "IntrusivePtr.h"
|
||||
#include "Scope.h"
|
||||
#include "PolicyFile.h"
|
||||
#include "Desc.h"
|
||||
|
@ -195,13 +197,13 @@ void get_first_statement(Stmt* list, Stmt*& first, Location& loc)
|
|||
static void parse_function_name(vector<ParseLocationRec>& result,
|
||||
ParseLocationRec& plr, const string& s)
|
||||
{ // function name
|
||||
ID* id = lookup_ID(s.c_str(), current_module.c_str());
|
||||
auto id = lookup_ID(s.c_str(), current_module.c_str());
|
||||
|
||||
if ( ! id )
|
||||
{
|
||||
string fullname = make_full_var_name(current_module.c_str(), s.c_str());
|
||||
debug_msg("Function %s not defined.\n", fullname.c_str());
|
||||
plr.type = plrUnknown;
|
||||
Unref(id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -209,7 +211,6 @@ static void parse_function_name(vector<ParseLocationRec>& result,
|
|||
{
|
||||
debug_msg("Function %s not declared.\n", id->Name());
|
||||
plr.type = plrUnknown;
|
||||
Unref(id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -217,7 +218,6 @@ static void parse_function_name(vector<ParseLocationRec>& result,
|
|||
{
|
||||
debug_msg("Function %s declared but not defined.\n", id->Name());
|
||||
plr.type = plrUnknown;
|
||||
Unref(id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -228,12 +228,9 @@ static void parse_function_name(vector<ParseLocationRec>& result,
|
|||
{
|
||||
debug_msg("Function %s is a built-in function\n", id->Name());
|
||||
plr.type = plrUnknown;
|
||||
Unref(id);
|
||||
return;
|
||||
}
|
||||
|
||||
Unref(id);
|
||||
|
||||
Stmt* body = 0; // the particular body we care about; 0 = all
|
||||
|
||||
if ( bodies.size() == 1 )
|
||||
|
@ -951,7 +948,7 @@ extern YYLTYPE yylloc; // holds start line and column of token
|
|||
extern int line_number;
|
||||
extern const char* filename;
|
||||
|
||||
Val* dbg_eval_expr(const char* expr)
|
||||
IntrusivePtr<Val> dbg_eval_expr(const char* expr)
|
||||
{
|
||||
// Push the current frame's associated scope.
|
||||
// Note: g_debugger_state.curr_frame_idx is the user-visible number,
|
||||
|
@ -968,7 +965,10 @@ Val* dbg_eval_expr(const char* expr)
|
|||
|
||||
const BroFunc* func = frame->GetFunction();
|
||||
if ( func )
|
||||
{
|
||||
Ref(func->GetScope());
|
||||
push_existing_scope(func->GetScope());
|
||||
}
|
||||
|
||||
// ### Possibly push a debugger-local scope?
|
||||
|
||||
|
@ -983,7 +983,7 @@ Val* dbg_eval_expr(const char* expr)
|
|||
yylloc.first_line = yylloc.last_line = line_number = 1;
|
||||
|
||||
// Parse the thing into an expr.
|
||||
Val* result = 0;
|
||||
IntrusivePtr<Val> result;
|
||||
if ( yyparse() )
|
||||
{
|
||||
if ( g_curr_debug_error )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue