Fixed "Read from pointer after free" error #coverity