Fix coverity reported problem: CID 1170168: Use after free.