]> granicus.if.org Git - pgbouncer/commitdiff
Fix rare crash
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 11 Sep 2018 10:30:53 +0000 (12:30 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 11 Sep 2018 10:30:53 +0000 (12:30 +0200)
SHOW FDS could in rare cases crash if a client had not been assigned
to a pool yet, causing a null pointer dereference.

fixes #311

src/admin.c

index 735b79f972ef826c3dc1306d4cf7ec03a307a5d4..ba09eb52baf411315277fe2d7e9ad2d4a263b0fc 100644 (file)
@@ -330,7 +330,7 @@ static bool show_one_fd(PgSocket *admin, PgSocket *sk)
        if (!mbuf_get_uint64be(&tmp, &ckey))
                return false;
 
-       if (sk->pool->db->auth_user && sk->auth_user && !find_user(sk->auth_user->name))
+       if (sk->pool && sk->pool->db->auth_user && sk->auth_user && !find_user(sk->auth_user->name))
                password = sk->auth_user->passwd;
 
        /* PAM requires passwords as well since they are not stored externally */