various: also use strdup_to() in cases where we don't return immediately

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2024-03-20 15:18:21 +01:00
parent 418b936d47
commit 4f77ddca59
4 changed files with 13 additions and 26 deletions
+3 -5
View File
@@ -3215,11 +3215,9 @@ int unit_file_exists_full(RuntimeScope scope, const LookupPaths *lp, const char
if (ret_path) {
assert(info);
_cleanup_free_ char *p = strdup(info->path);
if (!p)
return -ENOMEM;
*ret_path = TAKE_PTR(p);
r = strdup_to(ret_path, info->path);
if (r < 0)
return r;
}
return 1;