summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-05-09 14:28:19 +1000
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-05-09 14:28:19 +1000
commit5407d69f616c6ff5227e608cd54c4f3b85555ae2 (patch)
treedccabfb7561ed4a2ba1a7ced8a874fcd4197090c
parenta1435ed3c13cdceb815d5f41ee393e557b4acf67 (diff)
downloadmongo-5407d69f616c6ff5227e608cd54c4f3b85555ae2.tar.gz
Fix a leak of the buffer used to hold config files.
-rw-r--r--src/conn/conn_api.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c
index 1459aa08170..de705bdf464 100644
--- a/src/conn/conn_api.c
+++ b/src/conn/conn_api.c
@@ -1148,7 +1148,8 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
};
WT_CONFIG_ITEM cval, sval;
WT_CONNECTION_IMPL *conn;
- WT_DECL_ITEM(cbuf);
+ WT_DECL_ITEM(cbbuf);
+ WT_DECL_ITEM(cubuf);
WT_DECL_RET;
WT_SESSION_IMPL *session;
/* Leave space for optional additional configuration. */
@@ -1212,8 +1213,8 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
* Track the end of the stack, which always points to the config passed
* by the application.
*/
- WT_ERR(__conn_config_file(session, WT_BASECONFIG, cfg, &cbuf));
- WT_ERR(__conn_config_file(session, WT_USERCONFIG, cfg, &cbuf));
+ WT_ERR(__conn_config_file(session, WT_BASECONFIG, cfg, &cbbuf));
+ WT_ERR(__conn_config_file(session, WT_USERCONFIG, cfg, &cubuf));
WT_ERR(__conn_config_env(session, cfg));
/* Write the base configuration file, if we're creating the database. */
@@ -1321,8 +1322,10 @@ wiredtiger_open(const char *home, WT_EVENT_HANDLER *event_handler,
* Destroying the connection on error will destroy our session handle,
* cleanup using the session handle first, then discard the connection.
*/
-err: if (cbuf != NULL)
- __wt_buf_free(session, cbuf);
+err: if (cbbuf != NULL)
+ __wt_buf_free(session, cbbuf);
+ if (cbbuf != NULL)
+ __wt_buf_free(session, cubuf);
if (ret != 0 && conn != NULL)
WT_TRET(__wt_connection_close(conn));