ofz: Direct-leak

Change-Id: I40024334b394e4de6a1766321556689234da86ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131840
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2022-03-18 20:18:22 +00:00
parent f433d9cf8b
commit d643f9d5c6
3 changed files with 11 additions and 5 deletions

View file

@ -1175,12 +1175,13 @@ yyerrhandle:
return 1;
}
Node *mainParse(const char *_code)
{
initFlex( _code );
top = nullptr;
yyparse();
deinitFlex();
if( top )
return top;
else

View file

@ -2107,6 +2107,13 @@ void initFlex(const char *_code )
yy_switch_to_buffer( yy_scan_string(_code) );
}
void deinitFlex()
{
// flex faq-memory-leak
yy_delete_buffer(YY_CURRENT_BUFFER);
yy_init = 1;
}
int yywrap()
{
yy_delete_buffer( YY_CURRENT_BUFFER );

View file

@ -17,13 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_HWPFILTER_SOURCE_LEXER_HXX
#define INCLUDED_HWPFILTER_SOURCE_LEXER_HXX
#pragma once
void initFlex(char const* s);
void deinitFlex();
int yylex();
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */