diff options
author | Keith Bostic <keith@wiredtiger.com> | 2016-04-21 11:20:35 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2016-04-21 11:20:35 -0400 |
commit | 027992b9793eff07abc457516832d3d1407ca00c (patch) | |
tree | e45532b81164169f165ef274238830ed1f6dfbfa /test | |
parent | 95ac6a336431b752521a48bd3739035bd6dfcd9c (diff) | |
download | mongo-027992b9793eff07abc457516832d3d1407ca00c.tar.gz |
WT-2574: format doesn't free all allocated configure memory
Create a new routine that frees all allocated configuration memory at
the end of the run, separate from the function that clears temporary
settings before each new run.
Diffstat (limited to 'test')
-rw-r--r-- | test/format/config.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/test/format/config.c b/test/format/config.c index 37f7806e5da..385299a7a85 100644 --- a/test/format/config.c +++ b/test/format/config.c @@ -43,6 +43,7 @@ static void config_map_compression(const char *, u_int *); static void config_map_encryption(const char *, u_int *); static void config_map_file_type(const char *, u_int *); static void config_map_isolation(const char *, u_int *); +static void config_reset(void); /* * config_setup -- @@ -54,7 +55,7 @@ config_setup(void) CONFIG *cp; /* Clear any temporary values. */ - config_clear(); + config_reset(); /* * Periodically run in-memory. Do in-memory configuration first before @@ -519,18 +520,36 @@ config_file(const char *name) /* * config_clear -- - * Clear per-run values. + * Clear all configuration values. */ void config_clear(void) { CONFIG *cp; - /* Clear configuration data. */ + /* Clear all allocated configuration data. */ + for (cp = c; cp->name != NULL; ++cp) + if (cp->vstr != NULL) { + free((void *)*cp->vstr); + *cp->vstr = NULL; + } + free(g.uri); + g.uri = NULL; +} + +/* + * config_reset -- + * Clear per-run configuration values. + */ +static void +config_reset(void) +{ + CONFIG *cp; + + /* Clear temporary allocated configuration data. */ for (cp = c; cp->name != NULL; ++cp) { F_CLR(cp, C_TEMP); - if (!F_ISSET(cp, C_PERM) && - F_ISSET(cp, C_STRING) && cp->vstr != NULL) { + if (!F_ISSET(cp, C_PERM) && cp->vstr != NULL) { free((void *)*cp->vstr); *cp->vstr = NULL; } |