mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-27 06:26:15 +01:00
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:
parent
df66b25301
commit
0d49cd1b11
@ -989,6 +989,8 @@ g_get_host_name (void)
|
|||||||
#ifndef G_OS_WIN32
|
#ifndef G_OS_WIN32
|
||||||
gchar *tmp = g_malloc (sizeof (gchar) * 100);
|
gchar *tmp = g_malloc (sizeof (gchar) * 100);
|
||||||
failed = (gethostname (tmp, sizeof (gchar) * 100) == -1);
|
failed = (gethostname (tmp, sizeof (gchar) * 100) == -1);
|
||||||
|
if (failed)
|
||||||
|
g_clear_pointer (&tmp, g_free);
|
||||||
utmp = tmp;
|
utmp = tmp;
|
||||||
#else
|
#else
|
||||||
wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];
|
wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
|
Loading…
Reference in New Issue
Block a user