]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-varlink: remove unneeded strdup()
authorMike Yuan <me@yhndnzj.com>
Mon, 9 Jun 2025 18:06:59 +0000 (20:06 +0200)
committerMike Yuan <me@yhndnzj.com>
Tue, 17 Jun 2025 11:16:43 +0000 (13:16 +0200)
src/libsystemd/sd-varlink/sd-varlink.c

index 3255bf8ed3770a729ec1ccf26b798811a9e5356a..545311a1182c340eda547d8f26b80c421efb0877 100644 (file)
@@ -327,15 +327,11 @@ static int varlink_connect_ssh_unix(sd_varlink **ret, const char *where) {
         if (!h)
                 return log_oom_debug();
 
-        _cleanup_free_ char *c = strdup(e + 1);
-        if (!c)
-                return log_oom_debug();
-
-        if (!path_is_absolute(c))
-                return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Remote AF_UNIX socket path is not absolute, refusing: %s", c);
+        if (!path_is_absolute(e + 1))
+                return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Remote AF_UNIX socket path is not absolute, refusing: %s", e + 1);
 
         _cleanup_free_ char *p = NULL;
-        r = path_simplify_alloc(c, &p);
+        r = path_simplify_alloc(e + 1, &p);
         if (r < 0)
                 return r;