When was Leahy offside? When the free kick was taken? Impossible to tell from the video. Or did the referee think that there was a touch by a Walsall player after the keeper had fluffed it? From the video Guthrie missed his attempted back-header.
There are no indications that the assistant raised his flag for offside, in fact it looks as if the Walsall players were hoping for support from the assistant against the suggestion of a foul. If the flag was up I think the home players would have reacted differently.
We cannot see if the referee raised his arm for an indirect free-kick, which he would have done for offside, and when talking to the players signals something by touching one hand against the other - which makes me think that the referee gave hand ball against Leahy, which would explain the caution. A crazy decision, but since the Bristol goalkeeper was wearing bright red this might have been the cause for the confusion.
Incidentally, why do referees allow keepers to wear shirts which are similar to those of the outfield players?