gutils: Fix minor memory leak on error path

Introduced in commit d011223085.

Coverity CID: 1382472

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2017-11-06 10:31:52 +00:00
parent df66b25301
commit 0d49cd1b11

View File

@ -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];