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:
@@ -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)++;
|
||||
|
||||
Reference in New Issue
Block a user