]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
redisGetReply doesn't nullify the reply pointer when there's no reply...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 29 Jul 2023 15:42:02 +0000 (11:42 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 29 Jul 2023 15:42:02 +0000 (11:42 -0400)
src/modules/rlm_redis/rlm_redis.c

index dea448cfcca006ec7e76fd41cbcd3dd85f82237a..2cd540b1c6e94382b65bc974c37cd748c8ffb322 100644 (file)
@@ -207,7 +207,8 @@ parse_reply:
        /*
         *      Process the response for the command
         */
-       if (redisGetReply(conn->handle, (void **)&reply) == REDIS_OK) maybe_more = true;
+       reply = NULL;   /* Doesn't set reply to NULL on error *sigh* */
+       if ((redisGetReply(conn->handle, (void **)&reply) == REDIS_OK) && read_only) maybe_more = true;
        status = fr_redis_command_status(conn, reply);
        if (status != REDIS_RCODE_SUCCESS) {
                *reply_out = reply;
@@ -229,6 +230,7 @@ parse_reply:
        /*
         *      Process the response for READWRITE
         */
+       reply = NULL;   /* Doesn't set reply to NULL on error *sigh* */
        if ((redisGetReply(conn->handle, (void **)&reply) != REDIS_OK) ||
            (fr_redis_command_status(conn, reply) != REDIS_RCODE_SUCCESS)) {
                ROPTIONAL(REDEBUG, ERROR, "Setting READWRITE failed");