summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2016-04-22 16:32:56 -0400
committerKeith Bostic <keith@wiredtiger.com>2016-04-22 16:32:56 -0400
commit5be0124f3b62df150dda110163cab1a7c95c6796 (patch)
treec25e543c6c9e292171318b085937ac67a0688fdf /test
parent1a013c1e9150d8f713dda181daf9f21ec650ce1f (diff)
downloadmongo-5be0124f3b62df150dda110163cab1a7c95c6796.tar.gz
WT-2574: format doesn't free all allocated configure memory
I never remember that booleans don't take "on" or "off" arguments, change it so I don't have to.
Diffstat (limited to 'test')
-rw-r--r--test/format/config.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/format/config.c b/test/format/config.c
index ab02f358e27..15a9e515da0 100644
--- a/test/format/config.c
+++ b/test/format/config.c
@@ -595,7 +595,7 @@ void
config_single(const char *s, int perm)
{
CONFIG *cp;
- uint32_t v;
+ long v;
char *p;
const char *ep;
@@ -662,11 +662,20 @@ config_single(const char *s, int perm)
return;
}
- v = (uint32_t)strtoul(ep, &p, 10);
- if (*p != '\0') {
- fprintf(stderr, "%s: %s: illegal numeric value\n",
- g.progname, s);
- exit(EXIT_FAILURE);
+ v = -1;
+ if (F_ISSET(cp, C_BOOL)) {
+ if (strncmp(ep, "off", strlen("off")) == 0)
+ v = 0;
+ else if (strncmp(ep, "on", strlen("on")) == 0)
+ v = 1;
+ }
+ if (v == -1) {
+ v = strtol(ep, &p, 10);
+ if (*p != '\0') {
+ fprintf(stderr, "%s: %s: illegal numeric value\n",
+ g.progname, s);
+ exit(EXIT_FAILURE);
+ }
}
if (F_ISSET(cp, C_BOOL)) {
if (v != 0 && v != 1) {
@@ -680,7 +689,7 @@ config_single(const char *s, int perm)
g.progname, s, cp->min, cp->maxset);
exit(EXIT_FAILURE);
}
- *cp->v = v;
+ *cp->v = (uint32_t)v;
}
/*