Permalink
Browse files

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

  • Loading branch information...
ntrel committed Apr 25, 2012
1 parent a56373c commit 6e46a7bd3d6805a7af995e0487a4ac22c97c35e3
Showing with 8 additions and 3 deletions.
  1. +1 −0 HACKING
  2. +7 −3 tagmanager/options.c
View
@@ -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
@@ -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;
}

0 comments on commit 6e46a7b

Please sign in to comment.