]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic: fix error/memleak in socket-util
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 31 Jul 2015 09:51:33 +0000 (11:51 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 31 Jul 2015 09:52:21 +0000 (11:52 +0200)
Probably a typo, checking 'ret' instead of the return value 'p'. This
might cause the function to return failure, even though it succeeded.
Furthermore, it might leak resources.

src/basic/socket-util.c

index 62f99b322ec68b9d6ece112c50fd28b3b25c71a0..8fd3149276e555a1fcad87045495902ecb53e0d8 100644 (file)
@@ -583,7 +583,7 @@ int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_
 
                 } else {
                         p = strndup(sa->un.sun_path, sizeof(sa->un.sun_path));
-                        if (!ret)
+                        if (!p)
                                 return -ENOMEM;
                 }