/*
* Now actually open the database. This can generate errors,
- * which are returned in the errmsg
+ * which are returned in the errmsg
+ *
+ * DO NOT close the database or free(mdb) here !!!!
*/
int
db_open_database(JCR *jcr, B_DB *mdb)
if (!check_tables_version(jcr, mdb)) {
V(mutex);
- db_close_database(jcr, mdb);
return 0;
}
void
db_close_database(JCR *jcr, B_DB *mdb)
{
+ if (!mdb) {
+ return;
+ }
P(mutex);
mdb->ref_count--;
#ifdef HAVE_TREAD_SAFE_MYSQL