various: also use strdup_to() in cases where we don't return immediately
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -145,13 +145,10 @@ int check_password_quality(const char *password, const char *old, const char *us
|
||||
r = sym_pwquality_check(pwq, password, old, username, &auxerror);
|
||||
if (r < 0) {
|
||||
if (ret_error) {
|
||||
_cleanup_free_ char *e = NULL;
|
||||
|
||||
e = strdup(sym_pwquality_strerror(buf, sizeof(buf), r, auxerror));
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
|
||||
*ret_error = TAKE_PTR(e);
|
||||
r = strdup_to(ret_error,
|
||||
sym_pwquality_strerror(buf, sizeof(buf), r, auxerror));
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
return 0; /* all bad */
|
||||
|
||||
Reference in New Issue
Block a user