[Fontconfig] fontconfig: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 15 03:08:40 UTC 2020
test/test-conf.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
New commits:
commit 5cd11d19dfb2d901e1f6b690ae504d3bf5f5ff69
Author: Ben Wagner <bungeman at chromium.org>
Date: Thu Dec 10 14:12:05 2020 -0500
Fix wild frees and leak of fs in test-conf.
Reported by AddressSanitizer when running test-conf. The `query`,
`result`, and `result_fs` were not initialized to NULL so could result
in a wild free when first initialized.
The `method` was also not initialized to NULL so comparisons could be
made against random data if it had not yet been assigned.
The outer `fs` was never destroyed, but is also not used, so remove.
diff --git a/test/test-conf.c b/test/test-conf.c
index d4de21a..6097983 100644
--- a/test/test-conf.c
+++ b/test/test-conf.c
@@ -158,7 +158,6 @@ static FcBool
run_test (FcConfig *config, json_object *root)
{
json_object *tests;
- FcFontSet *fs;
int i, n, fail = 0;
if (!json_object_object_get_ex (root, "tests", &tests) ||
@@ -167,15 +166,15 @@ run_test (FcConfig *config, json_object *root)
fprintf (stderr, "W: No test cases defined\n");
return FcFalse;
}
- fs = FcFontSetCreate ();
n = json_object_array_length (tests);
for (i = 0; i < n; i++)
{
json_object *obj = json_object_array_get_idx (tests, i);
json_object_iter iter;
- FcPattern *query, *result;
- FcFontSet *result_fs;
- const char *method;
+ FcPattern *query = NULL;
+ FcPattern *result = NULL;
+ FcFontSet *result_fs = NULL;
+ const char *method = NULL;
if (json_object_get_type (obj) != json_type_object)
continue;
More information about the Fontconfig
mailing list