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

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