diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-07-08 23:00:54 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-07-08 23:00:54 -0400 |
commit | 226d1a898a73de3a0fc09247c83dceac7b5c8786 (patch) | |
tree | 168a4f90dedd8a3576897fbeda834efc3251edeb /tests | |
parent | 4ead5d2a2346c77a3dbc5e8d75221fa28e88f4e5 (diff) | |
download | pango-226d1a898a73de3a0fc09247c83dceac7b5c8786.tar.gz |
Fix a few memory leaks in tests
These were pointed out by asan.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-common.c | 12 | ||||
-rw-r--r-- | tests/testboundaries_ucd.c | 1 |
2 files changed, 11 insertions, 2 deletions
diff --git a/tests/test-common.c b/tests/test-common.c index 786973f1..60ecb7e1 100644 --- a/tests/test-common.c +++ b/tests/test-common.c @@ -125,14 +125,22 @@ print_attribute (PangoAttribute *attr, GString *string) g_string_append_printf (string, "%d", ((PangoAttrInt *)attr)->value); break; case PANGO_ATTR_FONT_DESC: - g_string_append_printf (string, "%s", pango_font_description_to_string (((PangoAttrFontDesc *)attr)->desc)); + { + char *text = pango_font_description_to_string (((PangoAttrFontDesc *)attr)->desc); + g_string_append_printf (string, "%s", text); + g_free (text); + } break; case PANGO_ATTR_FOREGROUND: case PANGO_ATTR_BACKGROUND: case PANGO_ATTR_UNDERLINE_COLOR: case PANGO_ATTR_OVERLINE_COLOR: case PANGO_ATTR_STRIKETHROUGH_COLOR: - g_string_append_printf (string, "%s", pango_color_to_string (&((PangoAttrColor *)attr)->color)); + { + char *text = pango_color_to_string (&((PangoAttrColor *)attr)->color); + g_string_append_printf (string, "%s", text); + g_free (text); + } break; case PANGO_ATTR_SHAPE: g_string_append_printf (string, "shape"); diff --git a/tests/testboundaries_ucd.c b/tests/testboundaries_ucd.c index f77abdcd..18ab94cc 100644 --- a/tests/testboundaries_ucd.c +++ b/tests/testboundaries_ucd.c @@ -298,6 +298,7 @@ do_test (const gchar *filename, } g_free (string); g_free (expected_attrs); + g_free (line); i++; } |