winbindd: don't leak state_path onto talloc tos
authorDavid Disseldorp <ddiss@samba.org>
Sun, 2 Nov 2014 19:21:36 +0000 (20:21 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 3 Nov 2014 22:46:05 +0000 (23:46 +0100)
Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd.c

index caa9ed127dd7aa1e8d23fad28f983bec68638a58..4978c97aaa89b00314c3b72b56084c69c9231b3b 100644 (file)
@@ -1110,6 +1110,7 @@ static bool winbindd_setup_listeners(void)
        struct winbindd_listen_state *priv_state = NULL;
        struct tevent_fd *fde;
        int rc;
+       char *socket_path;
 
        pub_state = talloc(winbind_event_context(),
                           struct winbindd_listen_state);
@@ -1143,9 +1144,15 @@ static bool winbindd_setup_listeners(void)
                goto failed;
        }
 
+       socket_path = get_winbind_priv_pipe_dir();
+       if (socket_path == NULL) {
+               goto failed;
+       }
+
        priv_state->privileged = true;
        priv_state->fd = create_pipe_sock(
-               get_winbind_priv_pipe_dir(), WINBINDD_SOCKET_NAME, 0750);
+               socket_path, WINBINDD_SOCKET_NAME, 0750);
+       TALLOC_FREE(socket_path);
        if (priv_state->fd == -1) {
                goto failed;
        }