r14305: fixed a memory leak and a break error
authorAndrew Tridgell <tridge@samba.org>
Mon, 13 Mar 2006 06:56:07 +0000 (06:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:57:10 +0000 (13:57 -0500)
source/auth/auth_unix.c

index 417025dfdf317804620a12eaf2c0b44d6ac856be..959eb6703ccdddf72509c776417b0992d64f592f 100644 (file)
@@ -197,6 +197,7 @@ static int smb_pam_conv(int num_msg, const struct pam_message **msg,
                                (*reply)[num].resp_retcode = PAM_SUCCESS;
                                (*reply)[num].resp = NULL;
                                DEBUG(4,("PAM Info message in conversation function: %s\n", (msg[num]->msg)));
+                               break;
 
                        case PAM_ERROR_MSG:
                                (*reply)[num].resp_retcode = PAM_SUCCESS;
@@ -205,6 +206,10 @@ static int smb_pam_conv(int num_msg, const struct pam_message **msg,
                                break;
 
                        default:
+                               while (num > 0) {
+                                       SAFE_FREE((*reply)[num-1].resp);
+                                       num--;
+                               }
                                SAFE_FREE(*reply);
                                *reply = NULL;
                                DEBUG(1,("Error: PAM subsystme sent an UNKNOWN message type to the conversation function!\n"));