update the docs
free allocated memory before exit.