From b639687b60fb0bd1e2addfa960c3532bf3ebf2a3 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 18 Aug 2020 09:33:06 +0100 Subject: [PATCH] gtestutils: Fix a minor memory leak Coverity CID: #1430603 Signed-off-by: Philip Withnall --- glib/gtestutils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/glib/gtestutils.c b/glib/gtestutils.c index 8ca995cac..3b03e9831 100644 --- a/glib/gtestutils.c +++ b/glib/gtestutils.c @@ -1530,7 +1530,10 @@ void test_prgname = g_path_get_basename (g_get_prgname ()); if (*test_prgname == '\0') - test_prgname = g_strdup ("unknown"); + { + g_free (test_prgname); + test_prgname = g_strdup ("unknown"); + } tmpl = g_strdup_printf ("test_%s_XXXXXX", test_prgname); g_free (test_prgname);