]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Re: ld parser buffer leak
authorAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 03:53:43 +0000 (14:23 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 17 Jan 2025 03:58:22 +0000 (14:28 +1030)
Apparently reflex doesn't have yyalloc.

* ldlex.l (yy_create_string_buffer): Revert last change.

ld/ldlex.l

index f36362fefc1e3852191140334abd1fd76c1449d6..e704a979722e3991dd815a85743e7f6657ac1cdd 100644 (file)
@@ -529,13 +529,13 @@ yy_create_string_buffer (const char *string, size_t size)
 {
   YY_BUFFER_STATE b;
 
-  b = yyalloc (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 = yyalloc (b->yy_buf_size + 3);
+  b->yy_ch_buf = xmalloc (b->yy_buf_size + 3);
 
   b->yy_ch_buf[0] = '\n';
   strcpy (b->yy_ch_buf+1, string);