Skip to content

Commit cbdac2f

Browse files
haldunmatzbot
authored andcommitted
[ruby/prism] Silence clang analyzer warnings for the memory leaks
ruby/prism@68112c556e
1 parent 585fdfe commit cbdac2f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

prism/prism.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10445,6 +10445,8 @@ parse_write_name(pm_parser_t *parser, pm_constant_id_t *name_field) {
1044510445
name[length] = '=';
1044610446

1044710447
// Now switch the name to the new string.
10448+
// This silences clang analyzer warning about leak of memory pointed by `name`.
10449+
// NOLINTNEXTLINE(clang-analyzer-*)
1044810450
*name_field = pm_constant_pool_insert_owned(&parser->constant_pool, name, length + 1);
1044910451
}
1045010452

@@ -15707,6 +15709,9 @@ parse_regular_expression_named_captures(pm_parser_t *parser, const pm_string_t *
1570715709
if (memory == NULL) abort();
1570815710

1570915711
memcpy(memory, source, length);
15712+
15713+
// This silences clang analyzer warning about leak of memory pointed by `memory`.
15714+
// NOLINTNEXTLINE(clang-analyzer-*)
1571015715
local = pm_parser_local_add_owned(parser, (const uint8_t *) memory, length);
1571115716

1571215717
if (token_is_numbered_parameter(source, source + length)) {

0 commit comments

Comments
 (0)