[binutils-gdb] Re: ld parser buffer leak

Alan Modra amodra@sourceware.org
Fri Jan 17 03:59:17 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8bd9df098fe6c697a29f679613e95afb9c90e013

commit 8bd9df098fe6c697a29f679613e95afb9c90e013
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Jan 17 14:23:43 2025 +1030

    Re: ld parser buffer leak
    
    Apparently reflex doesn't have yyalloc.
    
            * ldlex.l (yy_create_string_buffer): Revert last change.

Diff:
---
 ld/ldlex.l | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ld/ldlex.l b/ld/ldlex.l
index f36362fefc1..e704a979722 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -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);


More information about the Binutils-cvs mailing list