From ddae8d4a13d58720a3118355fabc225a9d907160 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 17 Oct 2022 17:13:25 -0700 Subject: [PATCH] Change malloc to xmalloc in treesit.c * src/treesit.c (Ftreesit_parser_set_included_ranges): Change malloc to xmalloc. --- src/treesit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/treesit.c b/src/treesit.c index 60280e02898..5994f6c263d 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1335,8 +1335,7 @@ is nil, the PARSER is to parse the whole buffer. */) if (list_length (ranges) > UINT32_MAX) xsignal (Qargs_out_of_range, list2 (ranges, Flength (ranges))); uint32_t len = (uint32_t) list_length (ranges); - /* FIXME: We should test the return value of malloc below. */ - TSRange *treesit_ranges = malloc (sizeof(TSRange) * len); + TSRange *treesit_ranges = xmalloc (sizeof(TSRange) * len); struct buffer *buffer = XBUFFER (XTS_PARSER (parser)->buffer); for (int idx = 0; !NILP (ranges); idx++, ranges = XCDR (ranges)) -- 2.39.2