summaryrefslogtreecommitdiffstats
path: root/lexer/theme-lexer.l
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-04-06 09:12:03 +0200
committerDave Davenport <qball@gmpclient.org>2017-04-06 09:12:03 +0200
commit898b5466f0ba83dbe098ca40bf0d3bdda47f5033 (patch)
treec391965f3aaddb6d4cb5005bd12f177451141d2c /lexer/theme-lexer.l
parent387093a67367b6a0b4c6e0117ac664369bd615f4 (diff)
Fix memory leak on parser fail.
Diffstat (limited to 'lexer/theme-lexer.l')
-rw-r--r--lexer/theme-lexer.l16
1 files changed, 16 insertions, 0 deletions
diff --git a/lexer/theme-lexer.l b/lexer/theme-lexer.l
index a4d3b8e1..2a9709db 100644
--- a/lexer/theme-lexer.l
+++ b/lexer/theme-lexer.l
@@ -573,6 +573,14 @@ gboolean rofi_theme_parse_file ( const char *file )
yylex_destroy ();
yyin = NULL;
+ while ( (po = g_queue_pop_head ( file_queue ) )) {
+ if ( po ) {
+ if ( po->type == PT_FILE ){
+ fclose ( po->filein );
+ }
+ g_free ( po );
+ }
+ }
// Free up.
g_list_foreach ( imported_files, (GFunc)g_free, NULL);
g_list_free ( imported_files );
@@ -601,6 +609,14 @@ gboolean rofi_theme_parse_string ( const char *string )
int parser_retv = yyparse ( string );
yylex_destroy ();
+ while ( (po = g_queue_pop_head ( file_queue ) )) {
+ if ( po ) {
+ if ( po->type == PT_FILE ){
+ fclose ( po->filein );
+ }
+ g_free ( po );
+ }
+ }
// Free up.
g_list_foreach ( imported_files, (GFunc)g_free, NULL);
g_list_free ( imported_files );