Clean up some edge cases in the BDB code.
Clean up some edge cases in the BDB code.

Reviewed by: brane

* subversion/libsvn_fs_base/bdb/env.c
  (cleanup_error_info): New cleanup callback, handles freeing the thread
   local storeage if the thread exits before it's been cleaned up.
  (create_env): Pass cleanup_error_info in to apr_threadkey_private_create.
  (svn_fs_bdb__close): Only clean up the error info if the pool isn't NULL,
   so we avoid double frees in a theoretical edge case during shutdown.

jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion