[geany/geany] 6e46a7: Fix existing leak when a matching ignore.tags item is parsed

Nick Treleaven git-noreply at xxxxx
Wed Apr 25 15:13:56 UTC 2012


Branch:      refs/heads/master
Author:      Nick Treleaven <nick.treleaven at btinternet.com>
Committer:   Nick Treleaven <nick.treleaven at btinternet.com>
Date:        Wed, 25 Apr 2012 15:13:56
Commit:      6e46a7bd3d6805a7af995e0487a4ac22c97c35e3
             https://github.com/geany/geany/commit/6e46a7bd3d6805a7af995e0487a4ac22c97c35e3

Log Message:
-----------
Fix existing leak when a matching ignore.tags item is parsed


Modified Paths:
--------------
    HACKING
    tagmanager/options.c

Modified: HACKING
1 files changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -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.
 


Modified: tagmanager/options.c
10 files changed, 7 insertions(+), 3 deletions(-)
===================================================================
@@ -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;
 }


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list