From 7eb4b40dc74be2999f12a280a8c0a66b3f4b2caa Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 5 Oct 2021 22:08:05 +0200 Subject: [PATCH] patterns: Fixed multi-variable decl crash --- plugins/libimhex/source/pattern_language/parser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/libimhex/source/pattern_language/parser.cpp b/plugins/libimhex/source/pattern_language/parser.cpp index b99d61db0..774466cfd 100644 --- a/plugins/libimhex/source/pattern_language/parser.cpp +++ b/plugins/libimhex/source/pattern_language/parser.cpp @@ -715,8 +715,9 @@ namespace hex::pl { auto variableCleanup = SCOPE_GUARD { for (auto var : variables) delete var; }; do { - variables.push_back(create(new ASTNodeVariableDecl(getValue(-1).get(), type))); + variables.push_back(create(new ASTNodeVariableDecl(getValue(-1).get(), type->clone()))); } while (MATCHES(sequence(SEPARATOR_COMMA, IDENTIFIER))); + delete type; variableCleanup.release();