[glib] gutils: Fix minor memory leak on error path
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gutils: Fix minor memory leak on error path
- Date: Mon, 6 Nov 2017 10:32:31 +0000 (UTC)
commit 0d49cd1b11b1bd0bae2671da9ddd83a6227eb947
Author: Philip Withnall <withnall endlessm com>
Date: Mon Nov 6 10:31:52 2017 +0000
gutils: Fix minor memory leak on error path
Introduced in commit d011223085063ff23589fb92c7e68bcfb50fdd02.
Coverity CID: 1382472
Signed-off-by: Philip Withnall <withnall endlessm com>
glib/gutils.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/glib/gutils.c b/glib/gutils.c
index 32c5796..de4401a 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];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]