pam: Fix double free after verification error

The data->result was free'ed both in the loop (before breaking) and
afterwards. As the first case did not set the pointer to NULL, this
could result in a double free.

Fix this by simply removing the free that is in the loop and relying on
the cleanup later on.
This commit is contained in:
Benjamin Berg
2020-05-27 13:38:37 +02:00
parent ba60533f71
commit a7cf0ae3b2

View File

@ -423,12 +423,10 @@ do_verify (pam_handle_t *pamh,
ret = PAM_AUTHINFO_UNAVAIL; ret = PAM_AUTHINFO_UNAVAIL;
} else if (str_equal (data->result, "verify-disconnected")) { } else if (str_equal (data->result, "verify-disconnected")) {
ret = PAM_AUTHINFO_UNAVAIL; ret = PAM_AUTHINFO_UNAVAIL;
free (data->result);
break; break;
} else { } else {
send_info_msg (data->pamh, _("An unknown error occurred")); send_info_msg (data->pamh, _("An unknown error occurred"));
ret = PAM_AUTH_ERR; ret = PAM_AUTH_ERR;
free (data->result);
break; break;
} }
free (data->result); free (data->result);