Fix a valgrind error in winbind
authorVolker Lendecke <vl@samba.org>
Sun, 26 Jul 2009 18:20:50 +0000 (20:20 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 27 Jul 2009 14:15:54 +0000 (16:15 +0200)
When looking for idle clients, we dereferenced state->response. As this is
dynamically allocated now, the proper test is whether state->response exists at
all. This is the case when an async operation is in process at that moment.

source3/winbindd/winbindd.c

index 49faae116a4ab7ea45e753c0d6e85e11d1808d93..6863e93415fc8ab4bc42ac520c20b7d738180f04 100644 (file)
@@ -664,6 +664,7 @@ static void winbind_client_response_written(struct tevent_req *req)
        }
 
        TALLOC_FREE(state->mem_ctx);
+       state->response = NULL;
 
        req = wb_req_read_send(state, winbind_event_context(), state->sock,
                               WINBINDD_MAX_EXTRA_DATA);
@@ -816,7 +817,7 @@ static bool remove_idle_client(void)
        int nidle = 0;
 
        for (state = winbindd_client_list(); state; state = state->next) {
-               if (state->response->result != WINBINDD_PENDING &&
+               if (state->response == NULL &&
                    !state->getpwent_state && !state->getgrent_state) {
                        nidle++;
                        if (!last_access || state->last_access < last_access) {