Define array cleanup funcs through macros (#41559)

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-04-10 21:45:14 +02:00
committed by GitHub
43 changed files with 136 additions and 207 deletions
+4 -7
View File
@@ -1086,15 +1086,12 @@ static int enforce_user(
#if HAVE_PAM
static void pam_response_free_array(struct pam_response *responses, size_t n_responses) {
assert(responses || n_responses == 0);
FOREACH_ARRAY(resp, responses, n_responses)
erase_and_free(resp->resp);
free(responses);
static void pam_response_done(struct pam_response *response) {
erase_and_free(ASSERT_PTR(response)->resp);
}
static DEFINE_ARRAY_FREE_FUNC(pam_response_free_array, struct pam_response, pam_response_done);
typedef struct AskPasswordConvData {
const ExecContext *context;
const ExecParameters *params;