Rewrite the part of the conversation function that allocates the reply array;

it was inelegant and neglected to check the return value from malloc(3).

Sponsored by:	DARPA, NAI Labs
This commit is contained in:
Dag-Erling Smørgrav 2002-02-25 16:39:34 +00:00
parent 85148c8f03
commit 60769b19cd

View File

@ -1111,8 +1111,11 @@ auth_conv(int num_msg, const struct pam_message **msg,
{
int i;
cred_t *cred = (cred_t *) appdata;
struct pam_response *reply =
malloc(sizeof(struct pam_response) * num_msg);
struct pam_response *reply;
reply = calloc(num_msg, sizeof *reply);
if (reply == NULL)
return PAM_BUF_ERR;
for (i = 0; i < num_msg; i++) {
switch (msg[i]->msg_style) {