Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix existing leak when a matching ignore.tags item is parsed

  • Loading branch information...
commit 6e46a7bd3d6805a7af995e0487a4ac22c97c35e3 1 parent a56373c
@ntrel ntrel authored
Showing with 8 additions and 3 deletions.
  1. +1 −0  HACKING
  2. +7 −3 tagmanager/options.c
View
1  HACKING
@@ -340,6 +340,7 @@ Bugs to watch out for
* Inserting fields into structs in the plugin API instead of appending.
* Not breaking the plugin ABI when necessary.
* Using an idle callback that doesn't check main_status.quitting.
+* Forgetting to call vStringTerminate in CTags code.
* Forgetting CRLF line endings on Windows.
* Not handling Tabs & Spaces indent mode.
View
10 tagmanager/options.c
@@ -168,14 +168,18 @@ extern boolean isIgnoreToken (const char *const name,
const size_t nameLen = strlen (name);
unsigned int i;
guint len = g_strv_length (c_tags_ignore);
+ vString *token = vStringNew();
if (pIgnoreParens != NULL)
*pIgnoreParens = FALSE;
for (i = 0 ; i < len ; ++i)
{
- vString *token = vStringNewInit (c_tags_ignore[i]);
- const size_t tokenLen = vStringLength (token);
+ size_t tokenLen;
+
+ vStringCopyS (token, c_tags_ignore[i]);
+ vStringTerminate (token);
+ tokenLen = vStringLength (token);
if (tokenLen >= 2 && vStringChar (token, tokenLen - 1) == '*' &&
strncmp (vStringValue (token), name, tokenLen - 1) == 0)
@@ -205,8 +209,8 @@ extern boolean isIgnoreToken (const char *const name,
break;
}
}
- vStringDelete (token);
}
+ vStringDelete (token);
}
return result;
}
Please sign in to comment.
Something went wrong with that request. Please try again.