This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
I have found and fixed a huge memory leak in flex-2.5.4a.
It is big enough, and obvious enough that I suspect someone else
has already found and fixed it. However, I could find no reference
to it when I searched this site, nor on the web in general.
The bug is in skel.c, generated from flex.skl. I have attached
both files.
The changed code starts on line 1091 in flex.skl, and on line 1096 in skel.c.
Here is an excerpt showing the lines I have added (underlined)
**********************************************************************************************************
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
%*
{
if ( yy_current_buffer == new_buffer )
return;
if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
*yy_c_buf_p = yy_hold_char;
yy_current_buffer->yy_buf_pos = yy_c_buf_p;
yy_current_buffer->yy_n_chars = yy_n_chars;
}
/* Here we fix a huge memory leak - Before this fix
* yy_current_buffer was never freed. 7-11-2001
*/
YY_BUFFER_STATE Temp = yy_current_buffer;
yy_current_buffer = new_buffer;
if (NULL != Temp)
{
yy_delete_buffer (Temp);
}
yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yy_did_buffer_switch_on_eof = 1;
}
*****************************************************************************************************
Don Richardson, Acquire Media Corporation
drichardson@acquiremedia.com
<<flex.skl>>
<<scan.c>>
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |