alloc-util: add free_many() helper

We often free an array of things. Let's create a common helper for this,
and port some potential users over. (Not all, too lazy for that for
now).
This commit is contained in:
Lennart Poettering
2023-08-24 15:04:33 +02:00
parent a16e19c61d
commit 24ae45cb65
9 changed files with 21 additions and 30 deletions
+1 -7
View File
@@ -359,13 +359,7 @@ int rlimit_from_string_harder(const char *s) {
}
void rlimit_free_all(struct rlimit **rl) {
int i;
if (!rl)
return;
for (i = 0; i < _RLIMIT_MAX; i++)
rl[i] = mfree(rl[i]);
free_many((void**) rl, _RLIMIT_MAX);
}
int rlimit_nofile_bump(int limit) {