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 -7
View File
@@ -1098,13 +1098,9 @@ int get_ctty(pid_t pid, dev_t *ret_devnr, char **ret) {
return -EINVAL;
if (ret) {
_cleanup_free_ char *b = NULL;
b = strdup(w);
if (!b)
return -ENOMEM;
*ret = TAKE_PTR(b);
r = strdup_to(ret, w);
if (r < 0)
return r;
}
if (ret_devnr)