summaryrefslogtreecommitdiff
path: root/test/thread
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-05-23 08:27:20 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-05-23 08:27:20 -0400
commitd0158f310572f959981e5a030fc704cab814d1a3 (patch)
tree9fb4e1cfc42e43176afc0c9418a73a2330ff297b /test/thread
parentd9f1e21093c752f8a2fbcece93f09ddb44492e29 (diff)
downloadmongo-d0158f310572f959981e5a030fc704cab814d1a3.tar.gz
Coverity report 1215467, open FILE handle could be leaked.
Diffstat (limited to 'test/thread')
-rw-r--r--test/thread/stats.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/test/thread/stats.c b/test/thread/stats.c
index fda069d6bf5..704dd75d254 100644
--- a/test/thread/stats.c
+++ b/test/thread/stats.c
@@ -62,26 +62,24 @@ stats(void)
if ((ret = cursor->close(cursor)) != 0)
die("cursor.close", ret);
- if (multiple_files)
- return;
-
/* File statistics. */
- (void)snprintf(name, sizeof(name), "statistics:" FNAME, 0);
- if ((ret =
- session->open_cursor(session, name, NULL, NULL, &cursor)) != 0)
- die("session.open_cursor", ret);
-
- while ((ret = cursor->next(cursor)) == 0 &&
- (ret = cursor->get_value(cursor, &desc, &pval, &v)) == 0)
- (void)fprintf(fp, "%s=%s\n", desc, pval);
+ if (!multiple_files) {
+ (void)snprintf(name, sizeof(name), "statistics:" FNAME, 0);
+ if ((ret = session->open_cursor(
+ session, name, NULL, NULL, &cursor)) != 0)
+ die("session.open_cursor", ret);
- if (ret != WT_NOTFOUND)
- die("cursor.next", ret);
- if ((ret = cursor->close(cursor)) != 0)
- die("cursor.close", ret);
+ while ((ret = cursor->next(cursor)) == 0 &&
+ (ret = cursor->get_value(cursor, &desc, &pval, &v)) == 0)
+ (void)fprintf(fp, "%s=%s\n", desc, pval);
- if ((ret = session->close(session, NULL)) != 0)
- die("session.close", ret);
+ if (ret != WT_NOTFOUND)
+ die("cursor.next", ret);
+ if ((ret = cursor->close(cursor)) != 0)
+ die("cursor.close", ret);
+ if ((ret = session->close(session, NULL)) != 0)
+ die("session.close", ret);
+ }
(void)fclose(fp);
}