Fix memory leak when no protocol_violation event handler exists

This commit is contained in:
Jon Siwek 2019-05-24 08:58:59 -07:00
parent 7f0fb49612
commit 88278214a9
3 changed files with 8 additions and 4 deletions

View file

@ -1,4 +1,8 @@
2.6-335 | 2019-05-24 08:58:59 -0700
* Fix memory leak when no protocol_violation event handler exists (Jon Siwek, Corelight)
2.6-334 | 2019-05-23 20:40:03 -0700 2.6-334 | 2019-05-23 20:40:03 -0700
* Add an internal getenv wrapper function: zeekenv (Jon Siwek, Corelight) * Add an internal getenv wrapper function: zeekenv (Jon Siwek, Corelight)

View file

@ -1 +1 @@
2.6-334 2.6-335

View file

@ -679,6 +679,9 @@ void Analyzer::ProtocolConfirmation(Tag arg_tag)
void Analyzer::ProtocolViolation(const char* reason, const char* data, int len) void Analyzer::ProtocolViolation(const char* reason, const char* data, int len)
{ {
if ( ! protocol_violation )
return;
StringVal* r; StringVal* r;
if ( data && len ) if ( data && len )
@ -692,9 +695,6 @@ void Analyzer::ProtocolViolation(const char* reason, const char* data, int len)
else else
r = new StringVal(reason); r = new StringVal(reason);
if ( ! protocol_violation )
return;
EnumVal* tval = tag.AsEnumVal(); EnumVal* tval = tag.AsEnumVal();
Ref(tval); Ref(tval);