dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0172-pam_sss-Fix-leaking-of-memory-in-case-of-failures.patch

bb7cd1
From c58aac42664dd1a04edb37b0874109a6a88d0da1 Mon Sep 17 00:00:00 2001
bb7cd1
From: Lukas Slebodnik <lslebodn@redhat.com>
bb7cd1
Date: Mon, 5 Jun 2017 09:43:46 +0200
bb7cd1
Subject: [PATCH 172/181] pam_sss: Fix leaking of memory in case of failures
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
Found by coverity.
bb7cd1
bb7cd1
Reviewed-by: Fabiano FidĂȘncio <fidencio@redhat.com>
bb7cd1
(cherry picked from commit 818d01b4a0d332fff06db33c0c985b8c0f1417c7)
bb7cd1
---
bb7cd1
 src/sss_client/pam_sss.c | 3 +++
bb7cd1
 1 file changed, 3 insertions(+)
bb7cd1
bb7cd1
diff --git a/src/sss_client/pam_sss.c b/src/sss_client/pam_sss.c
bb7cd1
index 9732459e6fb7ce01c9445c423cf0a583ca36e036..303809b9ea05b5a8709c05ae230d5f289b57de31 100644
bb7cd1
--- a/src/sss_client/pam_sss.c
bb7cd1
+++ b/src/sss_client/pam_sss.c
bb7cd1
@@ -1517,10 +1517,12 @@ static int prompt_sc_pin(pam_handle_t *pamh, struct pam_items *pi)
bb7cd1
     if (pi->user_name_hint) {
bb7cd1
         ret = pam_get_item(pamh, PAM_CONV, (const void **)&conv;;
bb7cd1
         if (ret != PAM_SUCCESS) {
bb7cd1
+            free(prompt);
bb7cd1
             return ret;
bb7cd1
         }
bb7cd1
         if (conv == NULL || conv->conv == NULL) {
bb7cd1
             logger(pamh, LOG_ERR, "No conversation function");
bb7cd1
+            free(prompt);
bb7cd1
             return PAM_SYSTEM_ERR;
bb7cd1
         }
bb7cd1
 
bb7cd1
@@ -1540,6 +1542,7 @@ static int prompt_sc_pin(pam_handle_t *pamh, struct pam_items *pi)
bb7cd1
         mesg[1] = &((*mesg)[1]);
bb7cd1
 
bb7cd1
         ret = conv->conv(2, mesg, &resp, conv->appdata_ptr);
bb7cd1
+        free(prompt);
bb7cd1
         if (ret != PAM_SUCCESS) {
bb7cd1
             D(("Conversation failure: %s.", pam_strerror(pamh, ret)));
bb7cd1
             return ret;
bb7cd1
-- 
bb7cd1
2.9.4
bb7cd1