Skip to content

Commit

Permalink
fixup a memory leak
Browse files Browse the repository at this point in the history
the caller is responsible for freeing the pam_response from
conversations
  • Loading branch information
klali committed Jan 16, 2015
1 parent 168bfc7 commit 057c374
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pam_yubico.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ display_error(pam_handle_t *pamh, const char *message) {
}

D(("conv returned: '%s'", resp->resp));
free(resp);
return retval;
}
#endif /* HAVE_CR */
Expand Down Expand Up @@ -728,7 +729,7 @@ pam_sm_authenticate (pam_handle_t * pamh,
struct pam_conv *conv;
const struct pam_message *pmsg[1];
struct pam_message msg[1];
struct pam_response *resp;
struct pam_response *resp = NULL;
int nargs = 1;
ykclient_t *ykc = NULL;
struct cfg cfg_st;
Expand Down Expand Up @@ -875,7 +876,6 @@ pam_sm_authenticate (pam_handle_t * pamh,
}
}
msg[0].msg_style = cfg->verbose_otp ? PAM_PROMPT_ECHO_ON : PAM_PROMPT_ECHO_OFF;
resp = NULL;

retval = conv->conv (nargs, pmsg, &resp, conv->appdata_ptr);

Expand Down Expand Up @@ -1016,6 +1016,9 @@ pam_sm_authenticate (pam_handle_t * pamh,
DBG (("done. [%s]", pam_strerror (pamh, retval)));
pam_set_data (pamh, "yubico_setcred_return", (void*) (intptr_t) retval, NULL);

if (resp)
free (resp);

return retval;
}

Expand Down

0 comments on commit 057c374

Please sign in to comment.