Merge in SNORT/snort3 from ~YVELYKOZ/snort3:return_error_daq_handling to master
Squashed commit of the following:
commit
48dbb1120a85078f6eaefbf4ee824d08f684d619
Author: Yehor Velykozhon <yvelykoz@cisco.com>
Date: Wed May 17 15:32:47 2023 +0300
main: add Pig destructor to free dynamic memory
commit
07073ca724c9f6dea8d7d352b3503b157b530c25
Author: Yehor Velykozhon <yvelykoz@cisco.com>
Date: Fri May 5 16:00:32 2023 +0300
main: handling the return code in case of error in creation of daq instance
{
public:
Pig() = default;
+ ~Pig();
void set_index(unsigned index) { idx = index; }
unsigned idx = (unsigned)-1;
};
+Pig::~Pig()
+{
+ delete analyzer;
+ delete swapper;
+ delete athread;
+}
+
bool Pig::prep(const char* source)
{
const SnortConfig* sc = SnortConfig::get_conf();
{
for (unsigned i = 0; i < max_pigs; i++)
{
- if (pigs[i].prep(SFDAQ::get_input_spec(SnortConfig::get_conf()->daq_config, i)))
- swine++;
+ if (!pigs[i].prep(SFDAQ::get_input_spec(SnortConfig::get_conf()->daq_config, i)))
+ return;
}
+
+ swine += max_pigs;
}
// Iterate over the drove, spawn them as allowed, and handle their deaths.