mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Fix memory leaks resulting from 'when' and 'return when' statements.
Addresses #946.
This commit is contained in:
parent
7e5115460c
commit
d158c7ffdf
6 changed files with 106 additions and 6 deletions
|
@ -242,6 +242,7 @@ bool Trigger::Eval()
|
|||
|
||||
trigger->Cache(frame->GetCall(), v);
|
||||
trigger->Release();
|
||||
frame->ClearTrigger();
|
||||
}
|
||||
|
||||
Unref(v);
|
||||
|
@ -251,7 +252,6 @@ bool Trigger::Eval()
|
|||
timer_mgr->Cancel(timer);
|
||||
|
||||
Disable();
|
||||
UnregisterAll();
|
||||
Unref(this);
|
||||
|
||||
return true;
|
||||
|
@ -331,6 +331,7 @@ void Trigger::Timeout()
|
|||
#endif
|
||||
trigger->Cache(frame->GetCall(), v);
|
||||
trigger->Release();
|
||||
frame->ClearTrigger();
|
||||
}
|
||||
|
||||
Unref(v);
|
||||
|
@ -338,7 +339,6 @@ void Trigger::Timeout()
|
|||
}
|
||||
|
||||
Disable();
|
||||
UnregisterAll();
|
||||
Unref(this);
|
||||
}
|
||||
|
||||
|
@ -426,6 +426,12 @@ Val* Trigger::Lookup(const CallExpr* expr)
|
|||
return (i != cache.end()) ? i->second : 0;
|
||||
}
|
||||
|
||||
void Trigger::Disable()
|
||||
{
|
||||
UnregisterAll();
|
||||
disabled = true;
|
||||
}
|
||||
|
||||
const char* Trigger::Name() const
|
||||
{
|
||||
assert(location);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue