From 28ce42b050229f20036dd74492f66fb2352c070b Mon Sep 17 00:00:00 2001 From: Steve Grubb Date: Fri, 14 May 2021 09:59:38 -0400 Subject: plugin: Fix memory leaks g_file_get_contents allocates memory. It needs to be freed on any function exit. --- plugins/hostname.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/hostname.c b/plugins/hostname.c index f7ab9e8bc..1a9513adb 100644 --- a/plugins/hostname.c +++ b/plugins/hostname.c @@ -213,11 +213,10 @@ static void read_dmi_fallback(void) return; type = atoi(contents); + g_free(contents); if (type < 0 || type > 0x1D) return; - g_free(contents); - /* from systemd hostname chassis list */ switch (type) { case 0x3: -- cgit v1.2.1