Kaydet (Commit) d4143553 authored tarafından Colomban Wendling's avatar Colomban Wendling

Plug a memory leak in the C tag parser


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5564 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst a2d04123
...@@ -2891,6 +2891,7 @@ static void tagCheck (statementInfo *const st) ...@@ -2891,6 +2891,7 @@ static void tagCheck (statementInfo *const st)
else if (isContextualStatement (st)) else if (isContextualStatement (st))
{ {
tokenInfo *name_token = (tokenInfo *)prev; tokenInfo *name_token = (tokenInfo *)prev;
boolean free_name_token = FALSE;
if (isType (name_token, TOKEN_NAME)) if (isType (name_token, TOKEN_NAME))
{ {
...@@ -2927,6 +2928,7 @@ static void tagCheck (statementInfo *const st) ...@@ -2927,6 +2928,7 @@ static void tagCheck (statementInfo *const st)
char buffer[64]; char buffer[64];
name_token = newToken (); name_token = newToken ();
free_name_token = TRUE;
copyToken (name_token, contextual_token); copyToken (name_token, contextual_token);
sprintf(buffer, "anon_%s_%d", name_token->name->buffer, contextual_fake_count++); sprintf(buffer, "anon_%s_%d", name_token->name->buffer, contextual_fake_count++);
...@@ -2945,6 +2947,8 @@ static void tagCheck (statementInfo *const st) ...@@ -2945,6 +2947,8 @@ static void tagCheck (statementInfo *const st)
} }
} }
qualifyBlockTag (st, name_token); qualifyBlockTag (st, name_token);
if (free_name_token)
deleteToken (name_token);
} }
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment