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();