diff options
author | Robert Hensing <roberth@users.noreply.github.com> | 2023-06-29 11:31:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 11:31:53 +0200 |
commit | 1632f08ea2fd6628e2c0cf729ba5269153b3007c (patch) | |
tree | d46b6fe484479a29e7cdb77e424702c75a0e6860 /src/libexpr | |
parent | b8bb8026d22dac8e86a7ff8135e281b6ebef08f4 (diff) | |
parent | 3468cbaf479e3a2e9b3c7d6b00b2cb1976cce43e (diff) |
Merge pull request #8600 from inclyc/libexpr/fix-leaking-in-stripIndentation
libexpr: fix leaking `es2` in stripIndentation (parser.y)
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/parser.y | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 03e6fb02c..0d0004f9f 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -275,7 +275,12 @@ static Expr * stripIndentation(const PosIdx pos, SymbolTable & symbols, } /* If this is a single string, then don't do a concatenation. */ - return es2->size() == 1 && dynamic_cast<ExprString *>((*es2)[0].second) ? (*es2)[0].second : new ExprConcatStrings(pos, true, es2); + if (es2->size() == 1 && dynamic_cast<ExprString *>((*es2)[0].second)) { + auto *const result = (*es2)[0].second; + delete es2; + return result; + } + return new ExprConcatStrings(pos, true, es2); } |