rlimit-util: add a common destructor call for arrays of struct rlimit

This commit is contained in:
Lennart Poettering
2018-05-17 20:36:52 +02:00
parent 4f424df760
commit 31ce987c2b
4 changed files with 15 additions and 5 deletions
+10
View File
@@ -324,3 +324,13 @@ int rlimit_from_string_harder(const char *s) {
return rlimit_from_string(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]);
}