]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/vpick: use strdup_to where appropriate
authorMike Yuan <me@yhndnzj.com>
Fri, 19 Apr 2024 23:16:00 +0000 (07:16 +0800)
committerMike Yuan <me@yhndnzj.com>
Fri, 19 Apr 2024 23:16:00 +0000 (07:16 +0800)
src/shared/vpick.c

index 41bd7301a0c7cc4b4a71419a242659da41335d5e..0f90af0fd08b206b6450ba5e73b18d089f09a5b1 100644 (file)
@@ -185,11 +185,9 @@ static int pin_choice(
         if (!result.path)
                 return log_oom_debug();
 
-        if (filter->version) {
-                result.version = strdup(filter->version);
-                if (!result.version)
-                        return log_oom_debug();
-        }
+        r = strdup_to(&result.version, filter->version);
+        if (r < 0)
+                return r;
 
         *ret = TAKE_PICK_RESULT(result);
         return 1;