agent: Fix possible release of unitialize var in a genkey error case.