Refactor strv_env_replace() into strv_env_replace_consume()

All callers of strv_env_replace() would free the argument on error.
So let's follow the same pattern as with strv_consume (and similar
naming) and unconditionally "use up" the argument.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-02-16 16:10:14 +01:00
parent b230baaeb7
commit 13734c75b5
5 changed files with 24 additions and 38 deletions
+2 -4
View File
@@ -385,11 +385,9 @@ static int load_env_file_push(
if (!p)
return -ENOMEM;
r = strv_env_replace(m, p);
if (r < 0) {
free(p);
r = strv_env_replace_consume(m, p);
if (r < 0)
return r;
}
if (n_pushed)
(*n_pushed)++;