From 570f108f2f20f1de56e8d3895dcf1648a1aed65b Mon Sep 17 00:00:00 2001 From: Bill Brophy <bill.brophy@bull.com> Date: Wed, 12 Apr 2017 11:51:20 -0600 Subject: [PATCH] Always free the old dependency string when asked to rebuild. If the depend_list is NULL or has zero elements, the string should be cleared as well. Bug 3651. --- NEWS | 1 + src/slurmctld/job_scheduler.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4631815ebdf..92cb1b89384 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ documents those changes that are of interest to users and administrators. ========================== -- Increase --cpu_bind and --mem_bind field length limits. -- Fix segfault when using AdminComment field with job arrays. + -- Clear Dependency field when all dependencies are satisfied. * Changes in Slurm 17.02.2 ========================== diff --git a/src/slurmctld/job_scheduler.c b/src/slurmctld/job_scheduler.c index 4a36c60d7ea..a8a17deb8aa 100644 --- a/src/slurmctld/job_scheduler.c +++ b/src/slurmctld/job_scheduler.c @@ -2487,10 +2487,11 @@ static void _depend_list2str(struct job_record *job_ptr, bool set_or_flag) if (job_ptr->details == NULL) return; + xfree(job_ptr->details->dependency); + if (job_ptr->details->depend_list == NULL || list_count(job_ptr->details->depend_list) == 0) return; - xfree(job_ptr->details->dependency); depend_iter = list_iterator_create(job_ptr->details->depend_list); while ((dep_ptr = list_next(depend_iter))) { -- GitLab