From 3cf375127ece97c852c72d5571d045585b199086 Mon Sep 17 00:00:00 2001
From: Moe Jette <jette1@llnl.gov>
Date: Fri, 26 Sep 2003 22:35:57 +0000
Subject: [PATCH] Eliminate possible memory leak on g_slurm_auth_pack error.

---
 src/common/slurm_protocol_api.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index 839433990e2..ef243af5c35 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -478,13 +478,15 @@ int slurm_send_node_msg(slurm_fd fd, slurm_msg_t * msg)
         /* 
          * Pack auth credential
          */
-        if (g_slurm_auth_pack(auth_cred, buffer)) {
+        rc = g_slurm_auth_pack(auth_cred, buffer);
+        (void) g_slurm_auth_destroy(auth_cred);
+        if (rc) {
 		error("authentication: %s",
                        g_slurm_auth_errstr(g_slurm_auth_errno(auth_cred)));
         	free_buf(buffer);
 		slurm_seterrno_ret(SLURM_PROTOCOL_AUTHENTICATION_ERROR);
         }
-        (void) g_slurm_auth_destroy(auth_cred);
+ 
 
         
         /*
-- 
GitLab