Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
f6e93ea2
Commit
f6e93ea2
authored
Jul 12, 2008
by
Eric Pouech
Committed by
Alexandre Julliard
Jul 14, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhelp: Fixed memory leak in macro handling.
parent
6346250e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
macro.lex.l
programs/winhlp32/macro.lex.l
+13
-5
No files found.
programs/winhlp32/macro.lex.l
View file @
f6e93ea2
...
...
@@ -40,6 +40,8 @@ static LPCSTR macroptr;
static LPSTR strptr;
static int quote_stack[32];
static unsigned int quote_stk_idx = 0;
static LPSTR cache_string[32];
static int cache_used;
struct lexret yylval;
#define YY_INPUT(buf,result,max_size)\
...
...
@@ -66,8 +68,10 @@ struct lexret yylval;
/* opening a new one */
if (quote_stk_idx == 0)
{
strptr = HeapAlloc(GetProcessHeap(), 0, strlen(macroptr) + 1);
assert(cache_used < sizeof(cache_string) / sizeof(cache_string[0]));
strptr = cache_string[cache_used] = HeapAlloc(GetProcessHeap(), 0, strlen(macroptr) + 1);
yylval.string = strptr;
cache_used++;
BEGIN(quote);
}
else *strptr++ = yytext[0];
...
...
@@ -260,6 +264,7 @@ static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
BOOL MACRO_ExecuteMacro(LPCSTR macro)
{
BOOL ret = TRUE;
int t;
WINE_TRACE("%s\n", wine_dbgstr_a(macro));
...
...
@@ -283,17 +288,20 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
}
switch (t = yylex())
{
case EMPTY:
return 1
;
case EMPTY:
goto done
;
case ';': break;
default: ret
urn 0
;
default: ret
= FALSE; goto done
;
}
}
HeapFree(GetProcessHeap(), 0, strptr);
done:
strptr = NULL;
quote_stk_idx = 0;
for (t = 0; t < cache_used; t++)
HeapFree(GetProcessHeap(), 0, cache_string[t]);
cache_used = 0;
return
1
;
return
ret
;
}
#ifndef yywrap
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment