diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index 11a97a16cea8244e0df07c1fc29cb19a26ddcf2b..b3c075ed996cb8dd6d067d524d4125d819757cf8 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -1292,7 +1292,6 @@ slurm_cred_unpack(Buf buffer, uint16_t protocol_version)
 {
 	uint32_t     cred_uid, len;
 	slurm_cred_t *cred = NULL;
-	char *bit_fmt_str = NULL;
 	char       **sigp;
 	uint32_t     cluster_flags = slurmdb_setup_cluster_flags();
 
@@ -1383,19 +1382,20 @@ slurm_cred_unpack(Buf buffer, uint16_t protocol_version)
 
 		if (!(cluster_flags & CLUSTER_FLAG_BG)) {
 			uint32_t tot_core_cnt;
+			char *bit_fmt = NULL;
 			safe_unpack32(&tot_core_cnt, buffer);
-			safe_unpackstr_xmalloc(&bit_fmt_str, &len, buffer);
+			safe_unpackstr_xmalloc(&bit_fmt, &len, buffer);
 			cred->job_core_bitmap =
 				bit_alloc((bitoff_t) tot_core_cnt);
-			if (bit_unfmt(cred->job_core_bitmap, bit_fmt_str))
+			if (bit_unfmt(cred->job_core_bitmap, bit_fmt))
 				goto unpack_error;
-			xfree(bit_fmt_str);
-			safe_unpackstr_xmalloc(&bit_fmt_str, &len, buffer);
+			xfree(bit_fmt);
+			safe_unpackstr_xmalloc(&bit_fmt, &len, buffer);
 			cred->step_core_bitmap =
 				bit_alloc((bitoff_t) tot_core_cnt);
-			if (bit_unfmt(cred->step_core_bitmap, bit_fmt_str))
+			if (bit_unfmt(cred->step_core_bitmap, bit_fmt))
 				goto unpack_error;
-			xfree(bit_fmt_str);
+			xfree(bit_fmt);
 			safe_unpack16(&cred->core_array_size, buffer);
 			if (cred->core_array_size) {
 				safe_unpack16_array(&cred->cores_per_socket,
@@ -1432,7 +1432,7 @@ slurm_cred_unpack(Buf buffer, uint16_t protocol_version)
 	return cred;
 
 unpack_error:
-	xfree(bit_fmt_str);
+	xfree(bit_fmt);
 	slurm_mutex_unlock(&cred->mutex);
 	slurm_cred_destroy(cred);
 	return NULL;