From 0d49cd1b11b1bd0bae2671da9ddd83a6227eb947 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 6 Nov 2017 10:31:52 +0000 Subject: [PATCH] gutils: Fix minor memory leak on error path Introduced in commit d011223085063ff23589fb92c7e68bcfb50fdd02. Coverity CID: 1382472 Signed-off-by: Philip Withnall --- glib/gutils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/glib/gutils.c b/glib/gutils.c index 32c5796e4..de4401ad3 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -989,6 +989,8 @@ g_get_host_name (void) #ifndef G_OS_WIN32 gchar *tmp = g_malloc (sizeof (gchar) * 100); failed = (gethostname (tmp, sizeof (gchar) * 100) == -1); + if (failed) + g_clear_pointer (&tmp, g_free); utmp = tmp; #else wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];