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:
+1
-3
@@ -212,9 +212,7 @@ int strv_extend_strv(char ***a, char * const *b, bool filter_duplicates) {
|
||||
return (int) i;
|
||||
|
||||
rollback:
|
||||
for (size_t j = 0; j < i; j++)
|
||||
free(t[p + j]);
|
||||
|
||||
free_many_charp(t + p, i);
|
||||
t[p] = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user