summaryrefslogtreecommitdiff
path: root/source4/nsswitch/wb_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/nsswitch/wb_common.c')
-rw-r--r--source4/nsswitch/wb_common.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/nsswitch/wb_common.c b/source4/nsswitch/wb_common.c
index d7b4614f35..97f8232524 100644
--- a/source4/nsswitch/wb_common.c
+++ b/source4/nsswitch/wb_common.c
@@ -172,7 +172,7 @@ static int winbind_named_pipe_sock(const char *dir)
{
struct sockaddr_un sunaddr;
struct stat st;
- pstring path;
+ char *path;
int fd;
int wait_time;
int slept;
@@ -190,8 +190,7 @@ static int winbind_named_pipe_sock(const char *dir)
/* Connect to socket */
- snprintf(path, sizeof(path), "%s%s", dir, "/" WINBINDD_SOCKET_NAME);
-
+ asprintf(&path, "%s%s", dir, "/" WINBINDD_SOCKET_NAME);
ZERO_STRUCT(sunaddr);
sunaddr.sun_family = AF_UNIX;
strncpy(sunaddr.sun_path, path, sizeof(sunaddr.sun_path) - 1);
@@ -201,8 +200,11 @@ static int winbind_named_pipe_sock(const char *dir)
the winbindd daemon is not running. */
if (lstat(path, &st) == -1) {
+ SAFE_FREE(path);
return -1;
}
+
+ SAFE_FREE(path);
/* Check permissions on unix socket file */