Skip to content

Commit

Permalink
ndpi: fix memory in keyword setup
Browse files Browse the repository at this point in the history
- remove duplicate calls to ndpi_init_detection_module
- cleanup ndpi_init_detection_module when no longer needed
  • Loading branch information
jasonish committed Jan 24, 2025
1 parent 3258704 commit 26611f6
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions plugins/ndpi/ndpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ static DetectnDPIProtocolData *DetectnDPIProtocolParse(const char *arg, bool neg
if (unlikely(ndpi_struct == NULL))
return NULL;

ndpi_struct = ndpi_init_detection_module(NULL);
NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_struct, &all);
ndpi_finalize_initialization(ndpi_struct);
Expand Down Expand Up @@ -346,10 +345,10 @@ static DetectnDPIRiskData *DetectnDPIRiskParse(const char *arg, bool negate)
if (unlikely(ndpi_struct == NULL))
return NULL;

ndpi_struct = ndpi_init_detection_module(NULL);
NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_struct, &all);
ndpi_finalize_initialization(ndpi_struct);
ndpi_exit_detection_module(ndpi_struct);

if (isdigit(arg[0]))
risk_mask = atoll(arg);
Expand Down

0 comments on commit 26611f6

Please sign in to comment.