diff options
author | Dave Davenport <qball@gmpclient.org> | 2017-04-06 09:12:03 +0200 |
---|---|---|
committer | Dave Davenport <qball@gmpclient.org> | 2017-04-06 09:12:03 +0200 |
commit | 898b5466f0ba83dbe098ca40bf0d3bdda47f5033 (patch) | |
tree | c391965f3aaddb6d4cb5005bd12f177451141d2c /lexer/theme-lexer.l | |
parent | 387093a67367b6a0b4c6e0117ac664369bd615f4 (diff) |
Fix memory leak on parser fail.
Diffstat (limited to 'lexer/theme-lexer.l')
-rw-r--r-- | lexer/theme-lexer.l | 16 |
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 ); |