}
_public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
- char *buffer = NULL, *cc;
+ _cleanup_free_ char *buffer = NULL;
const char *ret;
+ char *cc;
int r;
assert_return(path, -EINVAL);
if (!buffer)
return -ENOMEM;
- *path = buffer;
+ *path = TAKE_PTR(buffer);
return 0;
}
return -ENOMEM;
}
- *path = buffer;
+ *path = TAKE_PTR(buffer);
return 0;
}
suffix += strspn(suffix, "/");
cc = path_join(ret, suffix);
-
- free(buffer);
-
if (!cc)
return -ENOMEM;
- *path = cc;
+ *path = TAKE_PTR(cc);
return 0;
}