From 20576b67048880622f7d01fab60a4cf91c9cdf48 Mon Sep 17 00:00:00 2001
From: Alejandro Sanchez <alex@schedmd.com>
Date: Mon, 27 Mar 2017 10:55:15 -0600
Subject: [PATCH] Fix double free issue when updating QOS with sacctmgr.

Fix double free issue from commit 3851f6193f3b44

Same issue from fixed in a different spot with b19637bd75068.

Bug 3617
---
 NEWS                  | 1 +
 src/sacctmgr/common.c | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 3d657ca72eb..1fd58681d0e 100644
--- a/NEWS
+++ b/NEWS
@@ -56,6 +56,7 @@ documents those changes that are of interest to users and administrators.
  -- node_features/knl_cray plugin - Fix memory leak.
  -- Fix wrong cpu_per_task count issue on heterogeneous system when dealing with
     steps.
+ -- Fix double free issue when updating QOS with sacctmgr.
 
 * Changes in Slurm 17.02.1-2
 ============================
diff --git a/src/sacctmgr/common.c b/src/sacctmgr/common.c
index 078d44d0b7f..bfa0d83ebbe 100644
--- a/src/sacctmgr/common.c
+++ b/src/sacctmgr/common.c
@@ -880,6 +880,8 @@ extern int sacctmgr_remove_assoc_usage(slurmdb_assoc_cond_t *assoc_cond)
 						      cluster, account,
 						      user);
 						rc = SLURM_ERROR;
+						slurmdb_destroy_update_object(
+							update_obj);
 						goto end_it;
 					}
 					list_append(update_obj->objects, rec);
@@ -898,6 +900,8 @@ extern int sacctmgr_remove_assoc_usage(slurmdb_assoc_cond_t *assoc_cond)
 					      "database",
 					      cluster, account);
 					rc = SLURM_ERROR;
+					slurmdb_destroy_update_object(
+						update_obj);
 					goto end_it;
 				}
 				list_append(update_obj->objects, rec);
@@ -925,7 +929,6 @@ end_it:
 
 	FREE_NULL_LIST(local_assoc_list);
 	FREE_NULL_LIST(local_cluster_list);
-	slurmdb_destroy_update_object(update_obj);
 
 	return rc;
 }
-- 
GitLab