From 94cfea9c47ff34ced8ba94f32b6ffe342e9ca8ea Mon Sep 17 00:00:00 2001
From: Morris Jette <jette@schedmd.com>
Date: Fri, 19 Jan 2018 15:48:49 -0700
Subject: [PATCH] Fix memory leaks

Introduced in commit f2efbb606a8ecbb1fbff79549d439297c65188fb
Coverity CID 182262, 182263 and 182264
---
 .../knl_generic/node_features_knl_generic.c              | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/plugins/node_features/knl_generic/node_features_knl_generic.c b/src/plugins/node_features/knl_generic/node_features_knl_generic.c
index 72efd899787..670432b9ad3 100644
--- a/src/plugins/node_features/knl_generic/node_features_knl_generic.c
+++ b/src/plugins/node_features/knl_generic/node_features_knl_generic.c
@@ -2057,8 +2057,7 @@ extern void node_features_p_get_config(List *data)
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
 	key_pair->name = xstrdup("AllowUserBoot");
-	key_pair->value = xstrdup_printf("%s",
-				_make_uid_str(allowed_uid, allowed_uid_cnt));
+	key_pair->value = _make_uid_str(allowed_uid, allowed_uid_cnt);
 	list_append(*data, key_pair);
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
@@ -2068,12 +2067,12 @@ extern void node_features_p_get_config(List *data)
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
 	key_pair->name = xstrdup("DefaultMCDRAM");
-	key_pair->value = xstrdup_printf("%s", _knl_mcdram_str(default_mcdram));
+	key_pair->value = _knl_mcdram_str(default_mcdram);
 	list_append(*data, key_pair);
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
 	key_pair->name = xstrdup("DefaultNUMA");
-	key_pair->value = xstrdup_printf("%s", _knl_numa_str(default_numa));
+	key_pair->value = _knl_numa_str(default_numa);
 	list_append(*data, key_pair);
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
@@ -2098,7 +2097,7 @@ extern void node_features_p_get_config(List *data)
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
 	key_pair->name = xstrdup("SystemType");
-	key_pair->value = xstrdup_printf("%s", _knl_system_type_str(knl_system_type));
+	key_pair->value = xstrdup(_knl_system_type_str(knl_system_type));
 	list_append(*data, key_pair);
 
 	key_pair = xmalloc(sizeof(config_key_pair_t));
-- 
GitLab