From ee44c2ac7b3efdfd28c41cd32d7fb935b0582a97 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 3 Aug 2020 10:59:38 +0930 Subject: Use xmalloc rather than malloc As far as I can tell, the following comment is false nowadays. /* Calls to m-alloc get turned by sed into xm-alloc. */ Remove it, and call xmalloc. * ldlex.l (yy_create_string_buffer): Use xmalloc rather than malloc. * lexsup.c (parse_args): Likewise. --- ld/ldlex.l | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ld/ldlex.l') diff --git a/ld/ldlex.l b/ld/ldlex.l index 0fcbe84..4bd523e 100644 --- a/ld/ldlex.l +++ b/ld/ldlex.l @@ -515,14 +515,13 @@ yy_create_string_buffer (const char *string, size_t size) { YY_BUFFER_STATE b; - /* Calls to m-alloc get turned by sed into xm-alloc. */ - b = malloc (sizeof (struct yy_buffer_state)); + b = xmalloc (sizeof (struct yy_buffer_state)); b->yy_input_file = 0; b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = malloc ((unsigned) (b->yy_buf_size + 3)); + b->yy_ch_buf = xmalloc ((size_t) b->yy_buf_size + 3); b->yy_ch_buf[0] = '\n'; strcpy (b->yy_ch_buf+1, string); -- cgit v1.1