Yeah, but how do you free Gwydam then? They turn hostile if you make any attempt of getting him from the gallows.
Just keep him alive. Which is admittedly a bit of a classic escort quest as it's also a protracted fight with the friendly local voidwoken and he has no sense of self-preservation.