summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith.bostic@mongodb.com>2016-12-16 10:38:55 -0500
committerDon Anderson <dda@mongodb.com>2016-12-16 10:38:55 -0500
commitea8b8b7688acbeea1a1a3a0ee84c8373d8f8a32d (patch)
tree59a894e68d7ca923a9ab33430d6d2b9e207fa876
parent4873051264a2eddbcdb09198990cf380e57a97ab (diff)
downloadmongo-ea8b8b7688acbeea1a1a3a0ee84c8373d8f8a32d.tar.gz
WT-3084 Fix Coverity resource leak complaint. (#3205)
* The returned value after calling __wt_turtle_read() should only be set if ret is non-zero, but Coverity is convinced otherwise. The code path is used enough that Coverity complains a lot, add an error check to get some peace and quiet.
-rw-r--r--src/meta/meta_table.c13
-rw-r--r--src/schema/schema_alter.c3
2 files changed, 12 insertions, 4 deletions
diff --git a/src/meta/meta_table.c b/src/meta/meta_table.c
index 71be2496678..4f60728b2d2 100644
--- a/src/meta/meta_table.c
+++ b/src/meta/meta_table.c
@@ -262,8 +262,17 @@ __wt_metadata_search(WT_SESSION_IMPL *session, const char *key, char **valuep)
key, WT_META_TRACKING(session) ? "true" : "false",
__metadata_turtle(key) ? "" : "not ");
- if (__metadata_turtle(key))
- return (__wt_turtle_read(session, key, valuep));
+ if (__metadata_turtle(key)) {
+ /*
+ * The returned value should only be set if ret is non-zero, but
+ * Coverity is convinced otherwise. The code path is used enough
+ * that Coverity complains a lot, add an error check to get some
+ * peace and quiet.
+ */
+ if ((ret = __wt_turtle_read(session, key, valuep)) != 0)
+ __wt_free(session, *valuep);
+ return (ret);
+ }
/*
* All metadata reads are at read-uncommitted isolation. That's
diff --git a/src/schema/schema_alter.c b/src/schema/schema_alter.c
index e8b619737ed..26d800aa98e 100644
--- a/src/schema/schema_alter.c
+++ b/src/schema/schema_alter.c
@@ -13,8 +13,7 @@
* Alter a file.
*/
static int
-__alter_file(
- WT_SESSION_IMPL *session, const char *uri, const char *newcfg[])
+__alter_file(WT_SESSION_IMPL *session, const char *uri, const char *newcfg[])
{
WT_DECL_RET;
const char *cfg[4], *filename;