From cefb2f6ea7ac5c310a59f7f80efec07e51e4f69e Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Mon, 25 Aug 2014 10:29:37 -0700
Subject: [PATCH] Fix memory leak that could happen if req->cpu_bind is filled
 in.

This isn't the case in the current code so this isn't as big of a deal.

This logic will also be removed in 14.11 so it become less of a deal as
well, but just to be safe we cover the base.
---
 src/plugins/task/affinity/dist_tasks.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/plugins/task/affinity/dist_tasks.c b/src/plugins/task/affinity/dist_tasks.c
index e9561eeb9d0..a93b9f4f65e 100644
--- a/src/plugins/task/affinity/dist_tasks.c
+++ b/src/plugins/task/affinity/dist_tasks.c
@@ -240,6 +240,7 @@ void batch_bind(batch_job_launch_msg_t *req)
 		req->cpu_bind_type = CPU_BIND_MASK;
 		if (conf->task_plugin_param & CPU_BIND_VERBOSE)
 			req->cpu_bind_type |= CPU_BIND_VERBOSE;
+		xfree(req->cpu_bind);
 		req->cpu_bind = (char *)bit_fmt_hexmask(hw_map);
 		info("task/affinity: job %u CPU input mask for node: %s",
 		     req->job_id, req->cpu_bind);
-- 
GitLab