Hi,

I've noticed a bit odd part of the code (in src/connhelpers.h):

    connIncrRefs(conn);
    if (handler) handler(conn);
    connDecrRefs(conn);

Maybe I misunderstood the idea, but with !handler it would just be a useless refs change:

    conn->refs++;
    // nop
    conn->refs--;

Looks like we could wrap all three statements in the if block to make the code a bit cleaner and reasonable:

    if (handler) {
        connIncrRefs(conn);
        handler(conn);
        connDecrRefs(conn);
    }

If so, here is a small PR: #11198

Comment From: enjoy-binbin

closing due to https://github.com/redis/redis/pull/11198#issuecomment-1240543661