summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusan LoVerso <sue@mongodb.com>2016-02-19 11:44:52 -0500
committerSusan LoVerso <sue@mongodb.com>2016-02-19 11:44:52 -0500
commit0649731ce76cf4af4f8be388b2f3f3b002341351 (patch)
tree23784eee3f5721d7c40ff73c298e926475c6d354
parent99add10800fda24b81d0b8143e0e33acef3b641a (diff)
downloadmongo-0649731ce76cf4af4f8be388b2f3f3b002341351.tar.gz
WT-2349 Modify use of cfg.
-rw-r--r--src/conn/conn_api.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 84f8ad34e4e..1274c203649 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -1887,7 +1887,7 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
WT_DECL_RET;
const WT_NAME_FLAG *ft;
WT_SESSION_IMPL *session;
- bool config_base_set, free_merge_cfg;
+ bool config_base_set;
const char *enc_cfg[] = { NULL, NULL }, *merge_cfg;
char version[64];
@@ -1900,7 +1900,6 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
conn = NULL;
session = NULL;
- free_merge_cfg = false;
WT_RET(__wt_library_init());
WT_RET(__wt_calloc_one(NULL, &conn));
@@ -2025,12 +2024,20 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
* read-only are tested in their individual locations later.
*/
__conn_config_readonly(cfg);
- WT_ERR(__wt_config_merge(session, cfg, NULL, &conn->cfg));
- free_merge_cfg = true;
+ ret = __wt_config_merge(session, cfg, NULL, &conn->cfg);
+ __wt_free(session, merge_cfg);
+ WT_ERR(ret);
} else
conn->cfg = merge_cfg;
/*
+ * At this point we've merged the configuration stack and the final
+ * stack resides in conn->cfg. Set up the cfg array to use that now.
+ */
+ cfg[0] = conn->cfg;
+ cfg[1] = NULL;
+
+ /*
* Configuration ...
*
* We can't open sessions yet, so any configurations that cause
@@ -2201,8 +2208,6 @@ err: /* Discard the scratch buffers. */
__wt_scr_free(session, &i2);
__wt_scr_free(session, &i3);
- if (free_merge_cfg)
- __wt_free(session, merge_cfg);
/*
* We may have allocated scratch memory when using the dummy session or
* the subsequently created real session, and we don't want to tie down