1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2024-11-29 00:24:11 +01:00

free message at end of function

it was possible message was never freed if the sprintf() call failed
This commit is contained in:
Klas Lindfors 2015-07-08 16:11:42 +02:00
parent 9a132bcd07
commit 50ce40bbb1

View File

@ -775,7 +775,7 @@ pam_sm_authenticate (pam_handle_t * pamh,
int valid_token = 0;
struct pam_conv *conv;
const struct pam_message *pmsg[1];
struct pam_message msg[1];
struct pam_message msg[1] = {0};
struct pam_response *resp = NULL;
int nargs = 1;
ykclient_t *ykc = NULL;
@ -938,8 +938,6 @@ pam_sm_authenticate (pam_handle_t * pamh,
retval = conv->conv (nargs, pmsg, &resp, conv->appdata_ptr);
free ((char *) msg[0].msg);
if (retval != PAM_SUCCESS)
{
DBG (("conv returned error: %s", pam_strerror (pamh, retval)));
@ -1087,6 +1085,11 @@ done:
free (resp);
}
if(msg[0].msg)
{
free((char*)msg[0].msg);
}
return retval;
}