This case could be hit if this is the final callback (usually `entry != NULL`, but one extra call is made with `entry == NULL` to allow the callback to clean up). Normally the function would just send out the current reply with the flags set to 0 to mark it as the last one, but if we don't have a current reply (because the query result was empty, or we filled up and sent a reply on the previous callback) then we have to allocate and send an empty reply. If that allocation fails then we need to clean up the iterator state because this was the last callback.

This is duplicating the "Clean up state" block in the `entry == NULL` conditional below, but I couldn't think of a good way to factor it out.