summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorSteve Grubb <sgrubb@redhat.com>2021-05-14 09:59:38 -0400
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-05-14 17:04:35 -0700
commit28ce42b050229f20036dd74492f66fb2352c070b (patch)
tree9360a87b997eecd2d3e2e151fad7616df7f43de4 /plugins
parente65494e3a9fe8e25aed38b9d5fa8e576c3d7ad32 (diff)
downloadbluez-28ce42b050229f20036dd74492f66fb2352c070b.tar.gz
plugin: Fix memory leaks
g_file_get_contents allocates memory. It needs to be freed on any function exit.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/hostname.c3
1 files changed, 1 insertions, 2 deletions
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: