diff options
| author | Alexander Momchilov <alexander.momchilov@shopify.com> | 2025-03-31 10:28:24 -0400 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-03-31 19:57:33 +0000 |
| commit | 0fad0ce35ca0160288a64a8cc49e6dae1b199821 (patch) | |
| tree | 0e4d8bdb356f22b0b40af6ba9ce47ded984a2117 | |
| parent | 2d9036498e775dbc8a5a9ba42a6ab02f1c43f2ac (diff) | |
[ruby/prism] Use `xmalloc()`/`xfree()`
https://github.com/ruby/prism/commit/bd9027f0ab
| -rw-r--r-- | prism/prism.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/prism/prism.c b/prism/prism.c index f52008fe1e..cc634b59e3 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -4253,7 +4253,7 @@ pm_float_node_rational_create(pm_parser_t *parser, const pm_token_t *token) { const uint8_t *point = memchr(start, '.', length); assert(point && "should have a decimal point"); - uint8_t *digits = malloc(length); + uint8_t *digits = xmalloc(length); if (digits == NULL) { fputs("[pm_float_node_rational_create] Failed to allocate memory", stderr); abort(); @@ -4266,7 +4266,7 @@ pm_float_node_rational_create(pm_parser_t *parser, const pm_token_t *token) { digits[0] = '1'; if (end - point > 1) memset(digits + 1, '0', (size_t) (end - point - 1)); pm_integer_parse(&node->denominator, PM_INTEGER_BASE_DEFAULT, digits, digits + (end - point)); - free(digits); + xfree(digits); pm_integers_reduce(&node->numerator, &node->denominator); return node; |
