From f7faf4b217ebfb2d6bc770e14c585249f3bf20a3 Mon Sep 17 00:00:00 2001 From: hasherezade Date: Fri, 16 Feb 2024 05:23:10 -0800 Subject: [PATCH] [BUGFIX] In load_pattern_file: delete signatures after filling in the matcher --- utils/artefacts_util.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/utils/artefacts_util.cpp b/utils/artefacts_util.cpp index 7113ffdeb..38b0143b3 100644 --- a/utils/artefacts_util.cpp +++ b/utils/artefacts_util.cpp @@ -153,10 +153,13 @@ size_t pesieve::matcher::load_pattern_file(const char* filename) isLoaded = true; std::vector signatures; Signature::loadFromFile(filename, signatures); - if (!mainMatcher.addPatterns(signatures)) { - return 0; + const size_t added = mainMatcher.addPatterns(signatures); + // delete the loaded signatures: + for (auto itr = signatures.begin(); itr != signatures.end(); ++itr) { + Signature* sign = *itr; + delete sign; } - return signatures.size(); + return added; } bool pesieve::matcher::init_shellcode_patterns()