fixed Coverity issue 1147772. Write to a pointer after free.