summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-09-12 18:05:42 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-09-12 18:05:42 +0000
commit34f7aa27db13f19a73954cdf9e9a2701c2387ce3 (patch)
treea7d0a66c006f53a39037d0ff4a2424dd2d87f5fd
parent8f198233888ea15aca461bed2fd5b9b06e0397ba (diff)
parent867151e1f211e2c24cede98fc4c868217968ce5a (diff)
downloadpango-34f7aa27db13f19a73954cdf9e9a2701c2387ce3.tar.gz
Merge branch 'asan-fixes' into 'master'
Asan fixes See merge request GNOME/pango!238
-rwxr-xr-x.gitlab-ci/run-tests.sh3
-rw-r--r--lsan.supp7
-rw-r--r--tests/test-break.c22
-rw-r--r--tests/test-itemize.c2
-rw-r--r--tests/test-layout.c5
5 files changed, 31 insertions, 8 deletions
diff --git a/.gitlab-ci/run-tests.sh b/.gitlab-ci/run-tests.sh
index cca589b4..e5c8e9af 100755
--- a/.gitlab-ci/run-tests.sh
+++ b/.gitlab-ci/run-tests.sh
@@ -6,6 +6,9 @@ set +e
srcdir=$( pwd )
builddir=$1
+# Ignore memory leaks lower in dependencies
+export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp
+
meson test -C ${builddir} \
--print-errorlogs \
--suite=pango
diff --git a/lsan.supp b/lsan.supp
new file mode 100644
index 00000000..06a74df1
--- /dev/null
+++ b/lsan.supp
@@ -0,0 +1,7 @@
+leak:g_quark_init
+leak:libc.so
+leak:libfontconfig.so
+leak:libcairo.so
+leak:libpixman-1.so
+leak:libthai.so
+leak:libdatrie.so
diff --git a/tests/test-break.c b/tests/test-break.c
index db944fbb..c4359643 100644
--- a/tests/test-break.c
+++ b/tests/test-break.c
@@ -62,7 +62,6 @@ test_file (const gchar *filename, GString *string)
length = strlen (test);
len = g_utf8_strlen (test, -1) + 1;
- attrs = g_new (PangoLogAttr, len);
pango_parse_markup (test, -1, 0, &attributes, &text, NULL, &error);
g_assert_no_error (error);
@@ -79,6 +78,10 @@ test_file (const gchar *filename, GString *string)
g_test_skip (msg);
g_free (msg);
#endif
+ g_free (contents);
+ g_object_unref (layout);
+ pango_attr_list_unref (attributes);
+ g_free (text);
return FALSE;
}
@@ -225,6 +228,7 @@ test_file (const gchar *filename, GString *string)
g_object_unref (layout);
g_free (attrs);
g_free (contents);
+ g_free (text);
pango_attr_list_unref (attributes);
return TRUE;
@@ -255,7 +259,7 @@ test_break (gconstpointer d)
GString *dump;
gchar *diff;
- const char *old_locale = setlocale (LC_ALL, NULL);
+ char *old_locale = g_strdup (setlocale (LC_ALL, NULL));
setlocale (LC_ALL, "en_US.utf8");
if (strstr (setlocale (LC_ALL, NULL), "en_US") == NULL)
{
@@ -265,20 +269,26 @@ test_break (gconstpointer d)
g_test_skip (msg);
g_free (msg);
#endif
+ g_free (old_locale);
return;
}
- expected_file = get_expected_filename (filename);
-
dump = g_string_sized_new (0);
if (!test_file (filename, dump))
- return;
+ {
+ g_free (old_locale);
+ g_string_free (dump, TRUE);
+ return;
+ }
+
+ expected_file = get_expected_filename (filename);
diff = diff_with_file (expected_file, dump->str, dump->len, &error);
g_assert_no_error (error);
setlocale (LC_ALL, old_locale);
+ g_free (old_locale);
if (diff && diff[0])
{
@@ -294,9 +304,9 @@ test_break (gconstpointer d)
g_test_fail ();
g_strfreev (lines);
- g_free (diff);
}
+ g_free (diff);
g_string_free (dump, TRUE);
g_free (expected_file);
}
diff --git a/tests/test-itemize.c b/tests/test-itemize.c
index cd145e40..b22f3c2f 100644
--- a/tests/test-itemize.c
+++ b/tests/test-itemize.c
@@ -277,9 +277,9 @@ test_itemize (gconstpointer d)
g_test_fail ();
g_strfreev (lines);
- g_free (diff);
}
+ g_free (diff);
g_string_free (dump, TRUE);
g_free (expected_file);
}
diff --git a/tests/test-layout.c b/tests/test-layout.c
index 58ab46eb..5362d6fc 100644
--- a/tests/test-layout.c
+++ b/tests/test-layout.c
@@ -238,6 +238,9 @@ test_file (const gchar *filename, GString *string)
PangoWrapMode wrap = PANGO_WRAP_WORD;
PangoFontDescription *desc;
+ if (context == NULL)
+ context = pango_font_map_create_context (pango_cairo_font_map_get_default ());
+
g_file_get_contents (filename, &contents, &length, &error);
g_assert_no_error (error);
@@ -344,9 +347,9 @@ test_layout (gconstpointer d)
g_test_fail ();
g_strfreev (lines);
- g_free (diff);
}
+ g_free (diff);
g_string_free (dump, TRUE);
g_free (expected_file);
}