803fb7
From 605a35e6e8dcb2518a1fa8f92fb5fb00a0419345 Mon Sep 17 00:00:00 2001
803fb7
From: David Herrmann <dh.herrmann@gmail.com>
803fb7
Date: Fri, 29 Apr 2016 12:13:06 +0200
803fb7
Subject: [PATCH] basic: fix error/memleak in socket-util
803fb7
803fb7
Probably a typo, checking 'ret' instead of the return value 'p'. This
803fb7
might cause the function to return failure, even though it succeeded.
803fb7
Furthermore, it might leak resources.
803fb7
803fb7
Cherry-picked from: 0810bc568ace619b16e440805e93256730d45541
803fb7
Related: #1331667
803fb7
---
803fb7
 src/shared/socket-util.c | 2 +-
803fb7
 1 file changed, 1 insertion(+), 1 deletion(-)
803fb7
803fb7
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
803fb7
index a4e26b1d8..407d0afee 100644
803fb7
--- a/src/shared/socket-util.c
803fb7
+++ b/src/shared/socket-util.c
803fb7
@@ -544,7 +544,7 @@ int sockaddr_pretty(const struct sockaddr *_sa, socklen_t salen, bool translate_
803fb7
 
803fb7
                 } else {
803fb7
                         p = strndup(sa->un.sun_path, sizeof(sa->un.sun_path));
803fb7
-                        if (!ret)
803fb7
+                        if (!p)
803fb7
                                 return -ENOMEM;
803fb7
                 }
803fb7