diff --git a/NEWS b/NEWS
index c1b6e160e1996c52290e99417008d13a5bfc8b5d..34d0947d7916c655d3d6ff0633f8fd5ff6d7295f 100644
--- a/NEWS
+++ b/NEWS
@@ -384,6 +384,10 @@ documents those changes that are of interest to users and administrators.
  -- Update the slurm.conf man page documenting better nohold_on_prolog_fail
     variable.
  -- Don't trucate task ID information in "squeue --array/-r" or "sview".
+ -- Fix a bug which caused scontrol to core dump when releasing or
+    holding a job by name.
+ -- Fix unit conversion bug in slurmd which caused wrong memory calculation
+    for cgroups.
  -- Fix issue with GRES in steps so that if you have multiple exclusive steps
     and you use all the GRES up instead of reporting the configuration isn't
     available you hold the requesting step until the GRES is available.
diff --git a/src/common/gres.c b/src/common/gres.c
index cb544f539b45a65a224b9b26d831f8adccbd8b0e..56b8a0165cef91089d3f2d2569e83109c1603efb 100644
--- a/src/common/gres.c
+++ b/src/common/gres.c
@@ -4975,8 +4975,11 @@ static uint64_t _step_test(void *step_gres_data, void *job_gres_data,
 			gres_cnt = NO_VAL64;
 	} else if (job_gres_ptr->gres_cnt_step_alloc &&
 		   job_gres_ptr->gres_cnt_step_alloc[node_offset]) {
-		gres_cnt = job_gres_ptr->gres_cnt_alloc -
-			   job_gres_ptr->gres_cnt_step_alloc[node_offset];
+		gres_cnt = job_gres_ptr->gres_cnt_alloc;
+		if (!ignore_alloc) {
+			gres_cnt -= job_gres_ptr->
+				    gres_cnt_step_alloc[node_offset];
+		}
 		if (step_gres_ptr->gres_cnt_alloc > gres_cnt)
 			gres_cnt = 0;
 		else
diff --git a/src/scontrol/update_job.c b/src/scontrol/update_job.c
index 0d4d6fca7507ab932ec71eb03f1aeb2dd3e7ea79..8365778811e44a4fa1be960897b47239346a774c 100644
--- a/src/scontrol/update_job.c
+++ b/src/scontrol/update_job.c
@@ -370,6 +370,7 @@ scontrol_hold(char *op, char *job_str)
 	static job_info_msg_t *jobs = NULL;
 	job_array_resp_msg_t *resp = NULL;
 	int i, rc = SLURM_SUCCESS, rc2;
+	int j;
 	job_desc_msg_t job_msg;
 	uint32_t job_id = 0;
 	char *job_name = NULL;
@@ -493,16 +494,16 @@ scontrol_hold(char *op, char *job_str)
 					job_msg.job_id_str);
 			}
 		} else if (resp) {
-			for (i = 0; i < resp->job_array_count; i++) {
-				if ((resp->error_code[i] == SLURM_SUCCESS) &&
+			for (j = 0; j < resp->job_array_count; j++) {
+				if ((resp->error_code[j] == SLURM_SUCCESS) &&
 				    (resp->job_array_count == 1))
 					continue;
 				exit_code = 1;
 				if (quiet_flag == 1)
 					continue;
 				fprintf(stderr, "%s: %s\n",
-					resp->job_array_id[i],
-					slurm_strerror(resp->error_code[i]));
+					resp->job_array_id[j],
+					slurm_strerror(resp->error_code[j]));
 			}
 			slurm_free_job_array_resp(resp);
 		}
diff --git a/src/slurmctld/step_mgr.c b/src/slurmctld/step_mgr.c
index 49522f4a95e95a212462b580c28d0f223ed690fb..13ce25fd4fe13f25f2a9f842e884d61ceff41f6a 100644
--- a/src/slurmctld/step_mgr.c
+++ b/src/slurmctld/step_mgr.c
@@ -1183,11 +1183,7 @@ _pick_step_nodes (struct job_record  *job_ptr,
 			return nodes_avail;
 		FREE_NULL_BITMAP(nodes_avail);
 
-		/* total_task_cnt can be 0 if using GRES and all the
-		 * GRES are used up, so we want to pend if that is the
-		 * case.
-		 */
-		if (!total_task_cnt || (total_task_cnt >= step_spec->num_tasks))
+		if (total_task_cnt >= step_spec->num_tasks)
 			*return_code = ESLURM_NODES_BUSY;
 		else
 			*return_code = ESLURM_REQUESTED_NODE_CONFIG_UNAVAILABLE;
diff --git a/src/slurmd/common/slurmd_cgroup.c b/src/slurmd/common/slurmd_cgroup.c
index f19ad6e7e288a19dae9727471a62e70d4b337e16..430884bf3c28bae981baad49d5abb58825afee9d 100644
--- a/src/slurmd/common/slurmd_cgroup.c
+++ b/src/slurmd/common/slurmd_cgroup.c
@@ -432,7 +432,7 @@ extern int set_system_cgroup_cpus(char *phys_cpu_str)
 
 extern int set_system_cgroup_mem_limit(uint32_t mem_spec_limit)
 {
-	uint64_t mem_spec_bytes = mem_spec_limit * 1024 * 1024;
+    uint64_t mem_spec_bytes = (uint64_t)mem_spec_limit * 1024 * 1024;
 	xcgroup_set_uint64_param(&system_memory_cg, "memory.limit_in_bytes",
 				 mem_spec_bytes);
 	return SLURM_SUCCESS;