1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 
3 #include "alloc-util.h"
4 #include "macro.h"
5 #include "memory-util.h"
6 #include "nspawn-creds.h"
7 
credential_free(Credential * cred)8 static void credential_free(Credential *cred) {
9         assert(cred);
10 
11         cred->id = mfree(cred->id);
12         cred->data = erase_and_free(cred->data);
13         cred->size = 0;
14 }
15 
credential_free_all(Credential * creds,size_t n)16 void credential_free_all(Credential *creds, size_t n) {
17         size_t i;
18 
19         assert(creds || n == 0);
20 
21         for (i = 0; i < n; i++)
22                 credential_free(creds + i);
23 
24         free(creds);
25 }
26