diff options
| author | Haldun Bayhantopcu <haldun@github.com> | 2023-11-17 16:22:09 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-11-17 20:11:11 +0000 |
| commit | cbdac2f031888fb1cf5fcbabb80c180c3c547adb (patch) | |
| tree | bbc359a259f21f1b89dec0671dac6b7a5f2f8b13 | |
| parent | 585fdfe1f59951bcfe5c426601330c113c5a1e06 (diff) | |
[ruby/prism] Silence clang analyzer warnings for the memory leaks
https://github.com/ruby/prism/commit/68112c556e
| -rw-r--r-- | prism/prism.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/prism/prism.c b/prism/prism.c index 3df36b0d2e..f1b7088ecd 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -10445,6 +10445,8 @@ parse_write_name(pm_parser_t *parser, pm_constant_id_t *name_field) { name[length] = '='; // Now switch the name to the new string. + // This silences clang analyzer warning about leak of memory pointed by `name`. + // NOLINTNEXTLINE(clang-analyzer-*) *name_field = pm_constant_pool_insert_owned(&parser->constant_pool, name, length + 1); } @@ -15707,6 +15709,9 @@ parse_regular_expression_named_captures(pm_parser_t *parser, const pm_string_t * if (memory == NULL) abort(); memcpy(memory, source, length); + + // This silences clang analyzer warning about leak of memory pointed by `memory`. + // NOLINTNEXTLINE(clang-analyzer-*) local = pm_parser_local_add_owned(parser, (const uint8_t *) memory, length); if (token_is_numbered_parameter(source, source + length)) { |
