Skip to content

Commit 68112c5

Browse files
committed
Silence clang analyzer warnings for the memory leaks
1 parent a535949 commit 68112c5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/prism.c

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

1032910329
// Now switch the name to the new string.
10330+
// This silences clang analyzer warning about leak of memory pointed by `name`.
10331+
// NOLINTNEXTLINE(clang-analyzer-*)
1033010332
*name_field = pm_constant_pool_insert_owned(&parser->constant_pool, name, length + 1);
1033110333
}
1033210334

@@ -15582,6 +15584,9 @@ parse_regular_expression_named_captures(pm_parser_t *parser, const pm_string_t *
1558215584
if (memory == NULL) abort();
1558315585

1558415586
memcpy(memory, source, length);
15587+
15588+
// This silences clang analyzer warning about leak of memory pointed by `memory`.
15589+
// NOLINTNEXTLINE(clang-analyzer-*)
1558515590
local = pm_parser_local_add_owned(parser, (const uint8_t *) memory, length);
1558615591

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

0 commit comments

Comments
 (0)