1
1

Remove the finish_parsing function from various .l files. The function is incomplete (doesn't clean up the lex state) and should be replaced by *_yylex_destroy which correctly cleans up the state.

Checked with the flex 2.5.35. Verified with valgrind that this fixes several "still reachable" leaks.

cmr:v1.7

This commit was SVN r27571.
Этот коммит содержится в:
Nathan Hjelm 2012-11-06 19:26:14 +00:00
родитель bdedd8b0d3
Коммит 7fb5caea92
5 изменённых файлов: 9 добавлений и 97 удалений

Просмотреть файл

@ -11,6 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -32,7 +34,6 @@ BEGIN_C_DECLS
/*
* local functions
*/
static int finish_parsing(void) ;
static int btl_openib_ini_yywrap(void);
END_C_DECLS
@ -45,7 +46,7 @@ bool btl_openib_ini_parse_done = false;
char *btl_openib_ini_string = NULL;
#define yyterminate() \
return finish_parsing()
return btl_openib_ini_yylex_destroy ()
%}
@ -103,23 +104,6 @@ NAME_CHAR [A-Za-z0-9_\-\.\\\/]
%%
/*
* This cleans up at the end of the parse (since, in this case, we
* always parse the entire file) and prevents a memory leak.
*/
static int finish_parsing(void)
{
if (NULL != YY_CURRENT_BUFFER) {
yy_delete_buffer(YY_CURRENT_BUFFER);
#if defined(YY_CURRENT_BUFFER_LVALUE)
YY_CURRENT_BUFFER_LVALUE = NULL;
#else
YY_CURRENT_BUFFER = NULL;
#endif /* YY_CURRENT_BUFFER_LVALUE */
}
return YY_NULL;
}
static int btl_openib_ini_yywrap(void)
{

Просмотреть файл

@ -32,7 +32,6 @@ BEGIN_C_DECLS
/*
* local functions
*/
static int finish_parsing(void) ;
static int btl_wv_ini_yywrap(void);
END_C_DECLS
@ -45,7 +44,7 @@ bool btl_wv_ini_parse_done = false;
char *btl_wv_ini_string = NULL;
#define yyterminate() \
return finish_parsing()
return btl_wv_ini_yylex_destroy()
%}
@ -102,25 +101,6 @@ NAME_CHAR [A-Za-z0-9_\-\.\\\/]
%%
/*
* This cleans up at the end of the parse (since, in this case, we
* always parse the entire file) and prevents a memory leak.
*/
static int finish_parsing(void)
{
if (NULL != YY_CURRENT_BUFFER) {
yy_delete_buffer(YY_CURRENT_BUFFER);
#if defined(YY_CURRENT_BUFFER_LVALUE)
YY_CURRENT_BUFFER_LVALUE = NULL;
#else
YY_CURRENT_BUFFER = NULL;
#endif /* YY_CURRENT_BUFFER_LVALUE */
}
return YY_NULL;
}
static int btl_wv_ini_yywrap(void)
{
btl_wv_ini_parse_done = true;

Просмотреть файл

@ -15,7 +15,6 @@ BEGIN_C_DECLS
/*
* local functions
*/
static int finish_parsing(void) ;
static int coll_ml_config_yywrap(void);
END_C_DECLS
@ -28,7 +27,7 @@ bool coll_ml_config_parse_done = false;
char *coll_ml_config_string = NULL;
#define yyterminate() \
return finish_parsing()
return coll_ml_config_yylex_destroy()
%}
@ -100,23 +99,6 @@ NAME_CHAR [A-Za-z0-9_\-\.\\\/]
%%
/*
* This cleans up at the end of the parse (since, in this case, we
* always parse the entire file) and prevents a memory leak.
*/
static int finish_parsing(void)
{
if (NULL != YY_CURRENT_BUFFER) {
yy_delete_buffer(YY_CURRENT_BUFFER);
#if defined(YY_CURRENT_BUFFER_LVALUE)
YY_CURRENT_BUFFER_LVALUE = NULL;
#else
YY_CURRENT_BUFFER = NULL;
#endif /* YY_CURRENT_BUFFER_LVALUE */
}
return YY_NULL;
}
static int coll_ml_config_yywrap(void)
{

Просмотреть файл

@ -12,6 +12,8 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -34,7 +36,6 @@
BEGIN_C_DECLS
static int finish_parsing(void);
int opal_util_keyval_yywrap(void);
END_C_DECLS
@ -47,7 +48,7 @@ bool opal_util_keyval_parse_done = false;
char *opal_util_keyval_string = NULL;
#define yyterminate() \
return finish_parsing()
return opal_util_keyval_yylex_destroy()
%}
@ -84,23 +85,6 @@ CHAR [A-Za-z0-9_\-\.]
%%
/*
* This cleans up at the end of the parse (since, in this case, we
* always parse the entire file) and prevents a memory leak.
*/
static int finish_parsing(void)
{
if (NULL != YY_CURRENT_BUFFER) {
yy_delete_buffer(YY_CURRENT_BUFFER);
#if defined(YY_CURRENT_BUFFER_LVALUE)
YY_CURRENT_BUFFER_LVALUE = NULL;
#else
YY_CURRENT_BUFFER = NULL;
#endif /* YY_CURRENT_BUFFER_LVALUE */
}
return YY_NULL;
}
int opal_util_keyval_yywrap(void)
{
opal_util_keyval_parse_done = true;

Просмотреть файл

@ -32,13 +32,12 @@
BEGIN_C_DECLS
static int finish_parsing(void);
int orte_rmaps_rank_file_yywrap(void);
END_C_DECLS
#define yyterminate() \
return finish_parsing()
return orte_rmaps_rank_file_yylex_destroy()
/*
* global variables
@ -123,23 +122,6 @@ username { orte_rmaps_rank_file_value.sval = yytext;
%%
/*
* This cleans up at the end of the parse (since, in this case, we
* always parse the entire file) and prevents a memory leak.
*/
static int finish_parsing(void)
{
if (NULL != YY_CURRENT_BUFFER) {
yy_delete_buffer(YY_CURRENT_BUFFER);
#if defined(YY_CURRENT_BUFFER_LVALUE)
YY_CURRENT_BUFFER_LVALUE = NULL;
#else
YY_CURRENT_BUFFER = NULL;
#endif /* YY_CURRENT_BUFFER_LVALUE */
}
return YY_NULL;
}
int orte_rmaps_rank_file_wrap(void)
{
orte_rmaps_rank_file_done = true;