From e432fe6ea5a021cade2641fa1eea4e1508250014 Mon Sep 17 00:00:00 2001
From: jette <jette@schedmd.com>
Date: Sun, 24 Nov 2013 17:12:16 -0800
Subject: [PATCH] license reconfig bug

This fixes a problem where a job contains a license that is removed
in a slurmctld reconfiguration. Without this change, the job would
be left with a non-zero license_list pointer referencing memory that
had been freed
bug 527
---
 src/slurmctld/job_mgr.c     | 3 +--
 src/slurmctld/read_config.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/slurmctld/job_mgr.c b/src/slurmctld/job_mgr.c
index 3f875f0bc83..bf0ee5f18cf 100644
--- a/src/slurmctld/job_mgr.c
+++ b/src/slurmctld/job_mgr.c
@@ -5711,8 +5711,7 @@ static void _list_delete_job(void *job_entry)
 	xfree(job_ptr->gres_used);
 	FREE_NULL_LIST(job_ptr->gres_list);
 	xfree(job_ptr->licenses);
-	if (job_ptr->license_list)
-		list_destroy(job_ptr->license_list);
+	FREE_NULL_LIST(job_ptr->license_list);
 	xfree(job_ptr->mail_user);
 	xfree(job_ptr->name);
 	xfree(job_ptr->network);
diff --git a/src/slurmctld/read_config.c b/src/slurmctld/read_config.c
index 20081a5f649..8a2585fd536 100644
--- a/src/slurmctld/read_config.c
+++ b/src/slurmctld/read_config.c
@@ -1725,8 +1725,7 @@ static int _restore_job_dependencies(void)
 		}
 
 		license_list = license_validate(job_ptr->licenses, &valid);
-		if (job_ptr->license_list)
-			list_destroy(job_ptr->license_list);
+		FREE_NULL_LIST(job_ptr->license_list);
 		if (valid)
 			job_ptr->license_list = license_list;
 		if (IS_JOB_RUNNING(job_ptr))
-- 
GitLab