diff --git a/src/common/slurm_cred.c b/src/common/slurm_cred.c
index 55c6d52a650bc7beff8016ce1c5689a733295945..072500b6feb7fba0710ddeadf01e8b4e00443732 100644
--- a/src/common/slurm_cred.c
+++ b/src/common/slurm_cred.c
@@ -1016,6 +1016,10 @@ _slurm_cred_verify_signature(slurm_cred_ctx_t ctx, slurm_cred_t cred)
 	} else
 		rc = SLURM_SUCCESS;
 
+#ifdef HAVE_EVP_MD_CTX_CLEANUP
+	/* Note: Likely memory leak if this function is absent */
+	EVP_MD_CTX_cleanup(&ectx);
+#endif
 	free_buf(buffer);
 
 	return rc;